View Full Version : Double Buffering
01-06-2003, 08:11 PM
I'm doing a 2d game in OpenGL (I know it sounds weird but I have to...).
I'm wondering how I can use more video buffers to accelerate the rendering of my data to the screen.
I want to store my background in one buffer(#2) my sprites in another buffer(#3) and draw the scene on buffer #1 copying the back from the buffer #2 to the buffer #1 and then the sprites over the back from the buffer #3 to the buffer #1
When I'm using glDrawPixel to draw my image on the screen it reads from the CPU memory each time it draws to the scene. I'm wondering if glDrawList() could also be used???
Thanks to everyone for the infos.
Mr Pink http://www.opengl.org/discussion_boards/ubb/confused.gif
01-06-2003, 08:14 PM
I don't know exactly how to do triple buffering in OpenGL, but i can get at the second question. You can store vertices and pixels in display lists and they are stored on the GPU memory. So just load up your image data into a display list and call it when you are rendering.
01-07-2003, 03:29 AM
Store your background as a texture and just map it to a quad and draw your scene as normal. If your background changes do an offscreen render to texture...
01-07-2003, 04:45 AM
Double buffering means you have to "plates" you can draw to. You clear current backbuffer(plate) then draw elements one by one, then call swapbuffers. So it comes in front in one piece and the second one becomes backbuffer, that's only to prevent flickering for every element, for advanced purposes you can use only pbuffers.
01-10-2003, 05:12 PM
Thanks to everyone who answered !
I may not have been really clear in my question.....
In fact, I know about Page Flipping (using the Back buffer to draw then flipping at the VBL interupt so the Back becomes front and vice-versa).
What I want to do is use another buffer in addition to those 2 that would permit me to draw my back on.
This way when I would draw the background in the back buffer (which I'll eventually flip with glxSwapBuffer) I would just have to copy the back from video memory to video memory.
Otherwise it's too slow...
I'm really interested in the drawlist thing but I've tried many things and I really can't figure out what to put in between the BeginList and the EndList???
the glDrawPixel works between these but it doesn't seem to increase the number of frames per second.
Thanks to everyone,
Mr Pink http://www.opengl.org/discussion_boards/ubb/smile.gif
01-13-2003, 01:43 AM
I amjust a newbie but I think what is being suggested is that the glcopypixel command is very slow. The quick way to draw your image is to load you background as a texture. As well as the forground stuff. Then draw the background first as a texture then all the 2D elements over the top. As a texture this should easily have enough speed for most applications (I think). The display list is then you quad (with the bind texture in can't remeber if you can do this). This should be really quick,
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.