Xor mode in double buffering


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?


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.



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 )

Incremental updates is not “usual and simple” with double buffering.

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

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.

You must be very proud of your national team, glisgreat. They lasted a long time against 10 english footballers without conceding a goal.

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.

my condolences to you and your country - I was in fact supporting the germans against the diving italians.

See… We just play so bad that we don’t even qualify. Saves us a lot of trouble :stuck_out_tongue:

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.

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 :stuck_out_tongue: