PDA

View Full Version : Xor mode in double buffering



GL_Is_Great
07-03-2006, 05:01 AM
Hi.

Because multiple layers are not supported in most graphic cards ( I wish it was standard ), I need to make my local rendering cycle, like showing a cursor or highlighting part of the geometry, in a Xor mode so that I don't need to render the whole scene.

however some problems happen to me because in some graphic cars is works perfect, but in other it really messes up all the screen.


I am using windows.swapbuffer in each cycle, menaing that it is double buffered .

I was just trying

not to clear the color buffer
disabeling the depth test
Render previous step in Xor mode if available ( to erase)
Rendering in Xor mode new positions.

It seems that is is not working in some cards.

What is the correct procedure?

thanks

k_szczech
07-03-2006, 02:49 PM
Keep in mind that when using doublebuffering you need to keep contents of odd an even frames equal. So just rendering over previous frame may not work. You could remember last 2 frames and always render the difference between current frame and 2 frames back. However, you could run into situation when driver usrs triple buffering.
The solution could be to do offscreen rendering and then copying image to screen.

GL_Is_Great
07-03-2006, 03:18 PM
hi,

thanks.

Well, what I would like to do is to render a base scene, let's say like 10.000.000 lines ( big example ), keep the lines all the time over there, by leaving them in the color buffer, and all frames from that point on to just draw and redraw 10 lines or something else, so that only these lines would need to be rendered.

I mean, this must be a very simple and usual solution..(I think )

ZbuffeR
07-04-2006, 02:42 AM
Incremental updates is not "usual and simple" with double buffering.

simplest : use the front buffer only, and no swapbuffers :)

more involved : draw your fixed part, copy it to a texture to store it in long term. then, draw a quad with this texture and your new lines.

knackered
07-04-2006, 02:25 PM
You must be very proud of your national team, glisgreat. They lasted a long time against 10 english footballers without conceding a goal.

RigidBody
07-04-2006, 05:21 PM
aaaaaaahhhhhhhh come on knackered!
do you think you're the only person on earth capable of feeling the pain of not-being-world-champion? after all, the english team did well. and after tonight, i can tell you it's only a bit of a better feeling to be among the last 4 teams than it is to be among the last 8 teams.

knackered
07-05-2006, 07:10 AM
my condolences to you and your country - I was in fact supporting the germans against the diving italians.

Overmind
07-05-2006, 11:57 AM
See... We just play so bad that we don't even qualify. Saves us a lot of trouble :p

Back on topic:
If you want incremental updates and also double buffering, you can always emulate double buffering.

Render your scene to a texture. This texture is your "back buffer". You can render incremental updates to this texture as often as you want. When you want to display the frame, just render a fullscreen quad to your single buffered context.

That's logically the same as double buffering, but with the additional property that the backbuffer contents are preserved. Of course, you can't have vsync that way, you have to use real double buffering for that. It's not really a problem if you are not short on memory.

RigidBody
07-06-2006, 12:45 AM
my condolences to you and your country - I was in fact supporting the germans against the diving italians.thanks, knackered. it was a nice dream that we had for 3 weeks. of course we are a bit disappointed now, but one month ago nobody would have even thought that we could reach the semifinal. well, maybe things are better at the european championship in two years. good news for you, overmind: you don't even have to qualify for that :p