opengl and win 32

i’m kinda new at win 32 programming and i’m trying to integrate an opengl program with it…my question is: in the win 32 structure, where do i put in the

glutTimerFunc(40, TimerFunction, 1);

it doesn’t seem to be working…i also tried using a regular windows SetTimer() in my WM_CREATE to generate a WM_PAINT but the buffers aren’t swapping! if anyone could explain, or give me a link to a simple source code that uses win 32, opengl, and double buffering that would help a lot!! thanks


It’s difficult to say what’s wrong if you don’t give more information.
You must start telling me if you are programming in win32 api or using mfc.

See ya,

Are you using Glut or Win32? You give examples of things that would be from each. glutTimerFunc would only be used with Glut and you would call that before you call glutMainLoop(); With glut’s timers you have to remember that if you want it to be called over and over, you have to do the glutTimerFunc again at the end of your timer function.

With Win32, In your WM_CREATE you can just do a SetTimer(hWnd, 1, nTime, NULL); Then check for the WM_TIMER message in your message loop.

MFC is basically the same except that you override the virtual functions OnCreate, OnTimer, etc… (Depending on the architecture you use, there are a couple of different classes that these could potentially be overridden in.)