Jump to content
  • Advertisement
Sign in to follow this  
catlinz

OpenGL Choosepixelformat hanging thread

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!