PDA

View Full Version : OpenGL Window Lag



Elfinitiy
08-28-2011, 07:41 AM
I have a little problem.Sometimes when i move in the OpenGL scene,it just freezes for about 1-2 seconds and continues again.
If I put a Sleep(10); this doesn't seem to happen,but without it it just stops,and then continues.
I'm using wgl on windows 7 x64

while(1)
{
while(PeekMessage(&msgWindow,0,0,0,PM_REMOVE))
{

if(msgWindow.message == WM_QUIT)
goto exit;

TranslateMessage(&msgWindow);

DispatchMessage(&msgWindow);
}
//RenderCode Here....
glFlush();
SwapBuffers(hDC);
Sleep(10);
This is the message loop.I think that it may cause the problem

BionicBytes
08-28-2011, 09:12 AM
I'm not sure you should be putting the gl code inside your windows event handler.
What's your Main() function doing?
What event handler do you have for windows paint?

V-man
08-28-2011, 09:21 PM
Why do you flush the pipeline? (glFlush)
Did you try disabling Aero effect of Windows 7?

Elfinitiy
08-29-2011, 05:14 AM
I'm not sure you should be putting the gl code inside your windows event handler.
What's your Main() function doing?
What event handler do you have for windows paint?
Uses wgl to make context,and makes a window.
I have nothing in WM_PAINT
//
Is it a bad thing to flush the pipeline ?