View Full Version : Windows troubles
06-21-2002, 06:22 AM
I'm trying to get a GL window up and running in windows rather than using glut. the program i've wrote works fine on my win2k machine at work but fails on my home machine with win98 when it's trying to choose the pixel format for the window. i.e ChoosePixelFormat() returns 0 which isnt a valid pixel format.
06-21-2002, 07:51 AM
Maybe the hardware in your win2K system supports the features you asked for in a pixel format, while the win98 box does not. What is your PixelFormatDescriptor requesting?
Windows 98 also has a buggy pixel format interface--you'll get exceptions thrown. It usually won't affect your program, just for reference.
06-23-2002, 11:11 PM
The Win2k machine uses a matrox dual monitor card (sorry but i dont know the specifics) and the win98 machine uses a Geforce 2 GTS. the pixel format i'm requesting is nothing special, heres the code
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = ( PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL );
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = GLSCREEN_DEPTH;
pfd.dwLayerMask = PFD_MAIN_PLANE;
pfd.cDepthBits = GLSCREEN_DEPTH;
int PixelFormat = 0;
if((PixelFormat = ChoosePixelFormat(g_Hdc, &pfd)) == FALSE)
MessageBox(NULL, TEXT("ERROR : Could Not Find A Suitable Pixel Format"), sClassName, MB_ICONERROR);
(Sorry if the spacing is broke)
I actually copied this from another example and it works so i'm proberbly not doing something i should but i dont know what (i stepped through both programs and i cant see anything). i also check that everything else is alright (i.e Hwnd , Hinstance and such like) so it's not that
Cheers for your help so far
06-24-2002, 03:01 AM
I had this problem also one time... is your OpenGL library loaded?
06-24-2002, 04:07 AM
I've just found something about this on the net. my program doesnt have any opengl calls in it at the minute so the compiler doesnt link to opengl32.lib. when ChoosePixelFormat trys to use it it fails , returning 0.
It sounds like it's the best bet (win2k proberbly does something a bit different to win98 with respect to libraries) so i'll try it tonight when i get home and post a reply tomorrow.
Cheers for the help everyone.
06-24-2002, 11:22 PM
Thanks for the help everyone but it's sorted. The problem was that the "Helpful" compiler wasnt linking to opengl32.lib as i wasnt making any gl calls so ChoosePixelFormat (which uses it internally) was always failing.
i put a glGetString Call in the program and it worked fine.
Thanks again everyone
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.