OpenGL CreateWindowEx Query

Hi,

I have set up a basic OpenGL application using WinAPI calls for Window Management (i.e. CreateWindowEx, SetPixelFormat, MakeCurrentDC way). The Window’s Handler code checks for a WM_CHAR, WM_CREATE, WM_DESTROY events and everything works fine.
The WM-CHAR checks for escape key, if pressed it shuts down everything.

I just rendered a basic triangle on screen and this shows correctly. My problem is when I attempt to rotate the triangle, rotation does not work independantly until I hold down a key on the keyboard. My events message subroutine acts like this :-

PeekMessage lpMsg, NULL, 0, 0, %PM_NOREMOVE
IF GetMessage(lpMsg, NULL, 0, 0) THEN
    TranslateMessage lpMsg
    DispatchMessage lpMsg
ELSE
    EXIT
END IF

If I comment out the GetMessage code, the triangle does rotate independently but I lose the ability to check for escape key event. How can I intercept win events and rotate the triangle asynchronously? Hope you guys understand what I mean.

  • Rav.

Ok, ignore that I figured it out, code should infact be :-

IF PeekMessage (lpMsg, NULL, 0, 0, %PM_NOREMOVE) THEN
    IF GetMessage(lpMsg, NULL, 0, 0) THEN
        TranslateMessage lpMsg
        DispatchMessage lpMsg

ELSE
EXIT
END IF
END IF

Doh!