PDA

View Full Version : Frame Buffer?



DaHat
04-19-2000, 09:24 AM
I'll start by saying I am rather new to OGL but am learning quickly. My latest project was to port a simple wave table from basic to C++ using OGL, everything works fine except for one little thing, it appears that rather then drawing the whole image at once, it draws it line by line (which is the last thing I want). Thinking back to basic I could draw everything to an off screen location and then copy that image from off screen to onscreen, I'm not sure how to go about doing that in OGL.

Below is my drawing code that in embedded in 2 for loops used in accessing the arrays.

glBegin(GL_LINE_STRIP);
glVertex3f(rxa[x][y],rya[x][y],1);
glVertex3f(rxa[x+1][y],rya[x + 1][y],1);
glVertex3f(rxa[x][y+1],rya[x][y+1],1);
glVertex3f(rxa[x][y],rya[x][y],1);
glEnd();

Thanks.

Gorg
04-19-2000, 09:38 AM
when you set up your pixel format, you have to ask for double buffering with that constant :

PFD_DOUBLEBUFFER

the only other thing you have to do is when you finished doing all the opengl calls, you use

SwapBuffers(hDC);

And there you go!

DaHat
04-19-2000, 10:04 AM
Either I'm not putting it in the correct location, or it has to do with the fact that I'm using Glut for my window I'm drawing to instead of the regular Win32 API. Could that be the cause?

Gorg
04-19-2000, 10:51 AM
Ok. Forget what I said then.

with glut, when you call glutinitDisplayMode,

add GLUT_DOUBLE as a parameter.

when you finish all your opengl calls, you use
glutSwapBuffers();

[This message has been edited by Gorg (edited 04-19-2000).]