PDA

View Full Version : Flickering



cwhite40
09-19-2000, 12:07 PM
Ok people before I go any further I am going to tell you about my hardware... I have a (Try not to gasp too hard on this one) 133mhz http://www.opengl.org/discussion_boards/ubb/eek.gif P with MMX stuff. Now on to my problem. What happens is, every time I draw a scene with animation, my objects flicker, even simple objects. However an OpenGL example that had Textured(!!!) blocks did not flicker at all and took 2 seconds to load. The way I do it, it takes a lot of time to just create a plane. Any suggestions?

Bad Karma
09-19-2000, 03:21 PM
the following assumes you are using a windows api:

depending on what your code is built on (eg. win32 or mfc), it could be that you didn't tell windows not to erase the background, instead of letting opengl take care of itself.

for example: (using win32)
when you register the window class, you set the background brush to NULL and let glClearColor set it to black (or whatever color is your background)

or: (using mfc)
in the view class, an additional class function is needed:

BOOL COGLView::OnEraseBkgnd(CDC* pDC)
{
return TRUE; // opengl will erase the background, not windows
}
along, of course with the required WM_ message stuff.

Nicolas Lelong
09-20-2000, 06:09 AM
Hmf, when you chose the PixelFormat to use for you GL window, did you set the PDF_DOUBLEBUFFER flag ?

It not, you should add this flag to your PIXELFORMATDESCRIPTOR structure, and call SwapBuffers on the appropriate hDC when every call to GL primitive is finished.

That should fix the stuff up.

cwhite40
09-20-2000, 02:52 PM
Ok, I found all this stuff to be windows oriented. I want to do this for windows but (yah I know it's only for educational purposes) is there a way to do this with glut? Personally I'd rather create a window with about 3 lines of code http://www.opengl.org/discussion_boards/ubb/smile.gif.

cwhite40

Antonio
09-20-2000, 03:37 PM
I'm not sure what you're asking but could it be the case that you want to set double buffering using GLUT?

if thats the case then just call

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);

these are probably the most used constants. they provide animantion, true color + alpha channel, and depth buffer.

If you need more info check out my GLUT tutorial at
www.fatech.com/tech/opengl/glut (http://www.fatech.com/tech/opengl/glut)

Antonio

cwhite40
09-20-2000, 07:30 PM
I'll try that but to be more specific for any other answers, my problem is that the scene redraws everything, polygon by polygon, which is for some reason slow even for a small quad that is 10X10 no texturing.

http://www.opengl.org/discussion_boards/ubb/eek.gif cwhite40 http://www.opengl.org/discussion_boards/ubb/eek.gif

wolfman8k
09-22-2000, 11:46 PM
Try sticking

glFlush();

just before you swap the buffers.

cwhite40
09-23-2000, 10:49 AM
Done that already.