Sign in to follow this  
Elsenhans2

Need help with OpenGL and MFC

Recommended Posts

Hi folks! I'm a total newbie in the field of OpenGL and MFC programming. I managed to run an OpenGL child window within a dialog window, added some controls to it and made some objects rotate by mouse. Now I have two problems: 1 - Where can I place OpenGL commands to set up the OpenGL scene and the camera? I tried to put them everywhere but nothing ever happened. 2 - Where can I create display lists? It's like with problem number one, I put them everywhere and nothing happened. I adapted my code from the tutorial "How to Create a CHILD OpenGL Window in a Dialog" by Marc Guy on www.codeguru.com I hope these questions are not too stupid and maybe someone can answer them. Thank you in advance, Elsenhans

Share this post


Link to post
Share on other sites
If you've set things up properly you need to make sure your GL render context is current when calling OpenGL functions. I'm not sure how it works in MFC but in Win32 you use the function wglMakeCurrent passing in the window HDC and an HGLRC, after you have done that you can execute whatever GL commands you want.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this