View Full Version : OpenGL under WinXP
Hiya, I got a little question about WinXP and OpenGL. I used to code opengl under win98se, and I had no problems with it, I wrote a terrain engine and always got over 100 fps in it.
However, I recently installed winXP. If I run my terrain engine there, I barely get 30 fps. Anyone have an idea why that is? I'd think theres a driver issue, but if I play HL or any other FPS that uses OpenGL, my fps is just the same as back in win98se.
Any thoughts on this are appreciated!
05-02-2003, 07:49 AM
Have you downloaded your card vendor's latest drivers for XP?
05-02-2003, 08:32 AM
Are you synching with the monitor vsync? You can disable this in the video settings, I believe. You can also do it with a Windows call which I don't recall offhand and my graphics code is all at home http://www.opengl.org/discussion_boards/ubb/frown.gif
Perhaps the other applications disable this in software and your terrain program does not? If not, you'll be bound to the vsync rate of your monitor, with may be 30 FPS.
I don't think I explained that very well. Try a groups.google.com search for "vsync" in comp.graphics.api.opengl.
I'm aware of vsync, its off. I get 100 fps in HL so thats not the problem.
05-02-2003, 10:37 AM
Check what you get with glGetString(GL_VENDOR) and glGetString(GL_RENDERER);
Maybe something you are requesting for the pixelformat is putting you into software mode.
You're right, Deiussum, that's exactly what seems to be the problem. It's using GDI to draw my scene, no wonder its slow.
I'm not sure what could be wrong with my pixelformat though, since it used to work fine in win98se. I'll just paste my function here:
bool CRenderer::SetupPixelFormat(HDC hdc)
PIXELFORMATDESCRIPTOR pfd, *ppfd;
ppfd = &pfd;
ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR);
ppfd->nVersion = 1;
ppfd->dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
ppfd->dwLayerMask = PFD_MAIN_PLANE;
ppfd->iPixelType = PFD_TYPE_RGBA;
ppfd->cColorBits = 8;
ppfd->cDepthBits = 16;
ppfd->cAccumBits = 0;
ppfd->cStencilBits = 0;
pixelformat = ChoosePixelFormat(hdc, ppfd);
if ( (pixelformat = ChoosePixelFormat(hdc, ppfd)) == 0 )
MessageBox(NULL, "ChoosePixelFormat failed", "Error", MB_OK);
if (SetPixelFormat(hdc, pixelformat, ppfd) == FALSE)
MessageBox(NULL, "SetPixelFormat failed", "Error", MB_OK);
05-02-2003, 12:31 PM
Try to clear out the memory for the PIXELFORMATDESCRIPTOR before setting those fields. You don't set all of them, so it's possible that some garbage is left behind since the memory is allocated locally on the stack.
ZeroMemory(ppfd, sizeof(PIXELFORMATDESCRIPTOR); // After ppfd=&pfd;
If nothing else, you can also always enumerate through all the pixelformats and find the one with the properties you want, that is hardware accellerated.
One more thing. Usually when you use ChoosePixelFormat, you should use DescribePixelFormat before SetPixelFormat to make sure that the PIXELFORMATDESCRIPTOR matches the number of the PixelFormat returned by ChoosePixelFormat.
[This message has been edited by Deiussum (edited 05-02-2003).]
Your help was invaluable to me, I got it working (some garbage did sneak in).
Thanks a lot m8.
05-03-2003, 01:37 AM
Originally posted by Parsec:
ppfd->cColorBits = 8;
An 8 bit color buffer(no alpha) will most certainly give you a software rendering format, if one even exists. Try setting this to 24. It might work for now on your hardware/driver but could fail for anything else.
05-05-2003, 03:46 AM
You should also add PFD_DRAW_TO_WINDOW to your flags
I noticed exaclty the same problem : my fps was at 50 with win 2000 and 3 with winXP.
But I create my window with "glutCreateWindow" ... etc.
Should I use the window functions? what are the differences between a window that was created with glutCreateWindow (which is simple) and a windows created with "wglCreateContext(g_hDC)" .. etc ???
05-12-2003, 12:57 PM
Creating a window with glut will eventually create a window using the Win32 API CreateWindow function on Windows and then setup the pixelformat based on what you want. For Linux it does the glx equivalent. (wglCreateContext doesn't actually create the window for you, it just creates the GL context.)
What sort of things are you requesting for the window? (i.e. what do you pass to glutInitDisplayMode()?)
Also make sure you have the latest drivers for your card. Which card do you have, BTW?
[This message has been edited by Deiussum (edited 05-12-2003).]
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.