Pure OpenGL base code

I have problems with finding a good C++ template for windows xp.
I got Visual C++ 9.0 Express Editon, and found several base codes (using OpenGL) to use but they all have their weakness:

  • trouble with vsync (when using the mouse to rotate with it aren’t drawn correctly)
  • cpu goes 100% all the time (it’s okay for fullscreen, but should not when user switches to window mode)
  • the ALT+TAB problem (should only update game without drawing + save as much cpu as possible when minimazed/unfocused + able to/from reopen the window/fullscreen)
  • no icon (exe-icon & title-icon)

And also I do not want to use GLUT or SDL, as I am trying to use as clean code as possible. (GLUT hasn’t been updated in ages and SDL is good but not what I want)

It seems impossible to find ANY complete code-bases(source-files, project-files, etc.)

I know this is alot to ask, but I would appreciate it very much if someone could provide a such base-code.

  1. turn programatically vsync on (look for wglSwapInterval)
  2. sleep(0); after SwapBuffers
  3. looks like you have to catch window state changes in the WndProc and detect when the application is minimized in order to stop the rendering (for instance)
  4. The exe icon is the first icon loaded as resource in your application with visual studio ( at least that is how it works in vs7.1 and vs8, I dont know with vs9)

For complete window management base codes, look at nehe.gamedev.net. Latests tutorials has most of your issues solved.


Okay! This fixed many of problems but still nehe’s base code doesn’t fix the problem with flickering… (the vsync problem)

I even tried with wglSwapInterval but it looks like upper part of the screen isn’t drawn correctly (the rest is ok), I think there is bug in wglSwapInterval.
Trying to illustrate with chars how the screen looks like:

…1XXXXXXXXX2 <— notice this! upper part is misplaced.

How do I fix this?

My hardware is:
HP Pavilion zv5000 (4 year laptop), 1GB RAM, ATI Mobility Radeon 9000/9100 IGP (Using drivers from HP)

I haven’t seen a vsync problem like this since at least 15 years with my crappy VGA card. Try using different refresh rate for your LCD, such as 60 or 75 Hz. Check vsync is not forced off in the ATI control panel. Try to upgrade drivers, Omega Drivers v3.8.252 apparently are the last ones to support your card :

Are you sure that this is caused by vsync? are you using double buffer for color buffer?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.