View Full Version : OpenGL MFC components?
12-22-2003, 12:34 PM
I would like to create an MFC interface with an OpenGL window embedded in it. Is there an existing component that I can use? I am looking for a dialog driven application, rather than a single or multi document interface. If there is such a component, where can I find it?
Note: I will be using VC++ v. 6 to work with MFC.
12-22-2003, 12:53 PM
You can use the callbacks on the MFC objects to get the device context and create a graphics context specifying a pixel format descriptor. So in your oncreate callback you can create the context and in the ondraw (onpaint?) callback you can draw your OpenGL stuff.
It's pretty simple if you already know your way around MFC, look at the API calls:
You also need to set the size on the onSize call and maybe in oncreate also, it's been a while since I did this. There's lot's of stuff online.
Hmm... a quick google shows Microsoft even has this info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl1 .asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl1.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl3 .asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl3.asp)
See the other tutorials in the group for added fun.
This may be the easiest one stop shop for what you need though:
[This message has been edited by dorbie (edited 12-22-2003).]
I have a mfc app, and I am having to call wglMakeCurrent every frame before rendering to ensure I have the context. Is there a way to avoid this? Is wglMakeCurrent expensive?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.