Any speed loss when you use SetBuffer imageBuffer(createimage(1024, 768)) ?

BlitzPlus Forums/BlitzPlus Programming/Any speed loss when you use SetBuffer imageBuffer(createimage(1024, 768)) ?

3DBuzzFan(Posted 2003) [#1]
Hi.
I have to make a decision on which part of my program will use SetBuffer BackBuffer() and which will use SetBuffer ImageBuffer(CreateImage(1024, 768)).

Both parts of the program are independent.
The user is always at one screen or at the other.

But both screens must be preserved when switching back an forth between them.

I would really like to know which one is faster - if there is any difference between them, at all.

I would appreciate if someone at Blitz Research could give me an official answer to this question - so I would be able to choose not based on a guess, but on a fact.

Thanks,

Rui Barbosa Jr.


DrMartin(Posted 2003) [#2]
I think the CreateImage() command is relatively slow, it has to allocate quite a lot of memory. The back buffer is proably created when you open a screen with Graphics().
Once you have a "virtual image" I don't think there is a difference between the two. It's just pointers to different memory locations.
This is of course just my opinion, feel free to make fun of me if I'm wrong :-)


Simon S(Posted 2003) [#3]
That's pretty much my understanding of it DrMartin. Oh and Avoid ANY createimage during the main loop. It's very slow indeed.


3DBuzzFan(Posted 2003) [#4]
Hi.
I have tested both ways and was not able to perceive any timming difference between them.
But now I know one thing for sure: trying to grab a 1024 x 768 image is **way** too slow for the main loop, indeed... :^D.

Another quick question...
Is there a native command that allows me to invert the colors of a rectangle which is on the backbuffer()?
Kind of a XOR paint mode (for those who were born when we used it a lot...).

I donīt want to do it on a pixel-by-pixel basis.

Thanks,

/R


Rob(Posted 2003) [#5]
I think you'll need to poke to the graphics buffer pixel by pixel. It can be very quick...