PDA

View Full Version : Are there any difference of coding for Win2000 and WinXP



samfisher
07-01-2004, 06:55 PM
I has developing a software with OpenGL for a
while. After the released of my software, I have
received many reports from users about bugs in
Window2000.

Then I tested my software with two difference
system, WinXP and Win2000. The the result are
also difference, WinXP can run witout bug but in
Win2000 the sofware perform some bug the user
were report earlier.

I think that there must be something difference
about coding for Win2000 system. Are there any
suggestion or article about this issue? please
help

ZbuffeR
07-03-2004, 02:00 AM
Can you be more precise ? Which bug are talking about really ?

Xp and 2000 are closer than win98 and 2000 for example.

Did users had the latest video drivers for their graphic cards on both systems ? Most of opengl problems come from older/broken video drivers.

samfisher
07-03-2004, 02:56 AM
It was about the CPU usage. The result of test was obvious that my software using 12% of CPU in WinXP but 100% of CPU in Win2000, same version difference machine, but why?

I have developed the software with VC++, OpenGL and QT.

yooyo
07-03-2004, 07:22 AM
Have you try to turn on VSync in driver pages?
Anyway... if your loop looks like:


while (!bQuit)
{
ProcessWindowsMessages();
RenderScene();
SwapBuffers();
}then if you enable vsync, rendering will synced with display refresh and this usually lead to small CPU usage (app sleep in SwapBuffers call).
If you disable vsync SwapBuffers call will immediatly show new image. In this case you app will eat 100% of CPU time.

So.. check driver pages setup and turn on vsync, or use glSwapInterval(1) call after creating gl context to control buffer swaping.

yooyo

samfisher
07-03-2004, 08:00 PM
glSwapInterval?

I could not find any definition about this
command. Please tell me more.

If Vsync would changing the usage of CPU. So
It will be the same result in XP and 2000,
wouldn't it?

yooyo
07-04-2004, 02:30 AM
Sorry... my mistake... Do google for WGL_EXT_swap_control extension. If it's supported (and usually is supported) map entry point of wglSwapIntervalEXT function. Simple usage is:

wglSwapIntervalEXT(0); //disable vsync
wglSwapIntervalEXT(1); //enable vsync
wglSwapIntervalEXT(2); //show every 2-nd frame with vsync
wglSwapIntervalEXT(n); //show every n-th frame with vsync

yooyo

samfisher
07-06-2004, 01:32 AM
Thank you YooYo.

I like the idea of using Vsync On/Off.
It smarts to take the advantage of Monitor
refreshing interval to decrease CPU usage.

I'll apply the technique with my application soon.