Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Windows XP And OpenGL...

SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
Got a problem with an OpenGL game I've spent a LOT of time on when it runs in XP. yes, we all know how limited and suckage XP is, but this is ridiculous. My game is supposed to start and go fullscreen. Instead it changes the resolution to 800x600, which is how I have the game configured, but then it just stretches the window over the task-bar and all. It even ignores my call to hide the mouse cursor! I'm going to post the GL window creation function here in hopes that somebody can figure out why the HECK XP won't work with me.
[code]
bool CreateGLWindow()
{
GLuint PixelFormat;
PIXELFORMATDESCRIPTOR pfd;
DEVMODE dmScreenSettings;

memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(DEVMODE);
dmScreenSettings.dmPelsWidth = Config.Width;
dmScreenSettings.dmPelsHeight = Config.Height;
dmScreenSettings.dmBitsPerPel = Config.Bits;
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

if(ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
MessageBox(NULL, "Cannot set fullscreen mode.", "Startup Video Error", MB_OK | MB_ICONSTOP);
ErrorLog("OpenGL.cpp: Could not set fullscreen mode.");
return false;
}

if((WinData.Handle = CreateWindowEx(WS_EX_TOPMOST, WIN_CLASS_NAME, WIN_TITLE, WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, Config.Width, Config.Height, NULL, NULL, WinData.Instance, NULL)) == NULL)
{
ErrorLog("OpenGL.cpp: Could not create the primary window.");
return false;
}

memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = Config.Bits;
pfd.cDepthBits = Config.Depth;
pfd.iLayerType = PFD_MAIN_PLANE;

if((WinData.DeviceContext = GetDC(WinData.Handle)) == NULL)
{
KillGLWindow();
ErrorLog("OpenGL.cpp: Could not get a device context.");
return false;
}

if((PixelFormat = ChoosePixelFormat(WinData.DeviceContext, &pfd)) == NULL)
{
KillGLWindow();
ErrorLog("OpenGL.cpp: Can't find a suitable pixel format.");
return false;
}

if(!SetPixelFormat(WinData.DeviceContext, PixelFormat, &pfd))
{
KillGLWindow();
ErrorLog("OpenGL.cpp: Can't set the pixel format.");
return false;
}

if((WinData.RenderContext = wglCreateContext(WinData.DeviceContext)) == NULL)
{
KillGLWindow();
ErrorLog("OpenGL.cpp: Can't create a GL rendering context.");
return false;
}

if(!wglMakeCurrent(WinData.DeviceContext, WinData.RenderContext))
{
KillGLWindow();
ErrorLog("OpenGL.cpp: Can't activate the GL rendering context.");
return false;
}

ShowWindow(WinData.Handle, SW_SHOW);
SetForegroundWindow(WinData.Handle);
SetFocus(WinData.Handle);
ResizeGLScreen(Config.Width, Config.Height);

if(!InitGL())
{
KillGLWindow();
ErrorLog("OpenGL.cpp: OpenGL initialization failed.");
return false;
}

MainLog("Primary window created.");
return true;
}
[/code]
That's it! So why won't this thing go fullscren? It's really getting annoying, because when I compiled it on 98SE it always worked. Maybe we'll get lucky and the guys at MS will get an IQ above ten and realize that the ONLY way to make a kick-azz OS like Linux, is to stick with one, and continually release updates and patches, even if they charge for them. Heck, I'd gladly pay $25 or $50 a year for some kind of patch that replaces old files and adds support for newer things (64bit processors for instance).

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
Sign In or Register to comment.