This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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!!

##### Share on other sites
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.

##### Share on other sites
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!!

##### Share on other sites
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.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 27
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001791
×