Choosepixelformat hanging thread

Started by
2 comments, last by 21st Century Moose 12 years, 8 months ago
I've attached the (small) Visual Studio 2010 project with all the source inside it.
[attachment=4299:CaT.zip]

I'm trying to create a simple window (in Windows) with openGL capabilities. I've done it before, but for some reason this time, no matter what I try I can't get it to work. And by work I mean actually quit the program when the window is closed.


From what I have been able to figure out, the Windows function ChoosePixelFormat (is in the file window.cpp in the zip) creates a new thread when it is called, and this thread refuses to exit once the main thread finishes. I have no idea how to fix it, spent hours on it and have gotten nowhere. Hoping that someone here can help!!
Advertisement
I've never heard of that behaviour of ChoosePixelFormat, and have never encountered anything like this when using it. I have encountered the same symptom as you, but it's always been attributable to my own screw-up, so that's where I'd look first.

There are a number of things wrong with your code. Using both main and WinMain and not returning 0 from WM_DESTROY are two I've found from a brief look through it (I'd also advise changing your "running = false" line to a simple "break"). I'd advise you to fix these first and get it working the way a well-behaved Win32 app should work before even looking at the OpenGL side of things.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Hmmm, seems to work when I just put the entry point as WinMain and skip over all the main stuff, which is odd cause I've managed to do that before. I had had it that way to try and make it so it would be more portable in the end. Thanks muchly for your help!!
How about:#ifdef _WIN32
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#else
int main (int argc, char *argv[])
#endif

In all honesty, your window creation and video startup code is going to be completely differrent for different platforms anyway, so you may as well have different entry points too.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement