I have OpenGL code that I have to insern to MFC project, how can I do that?
Is there any Example that I work with?

Try MFC & OpenGL at

I strongly suggest you not to use MFC. Using MFC is only adding another layer between your code and openGL renderer. And, besides, OpenGL engine is NOT compatibile with C++ class syntax, since it uses in-state rendering, which means a sort of “brush” properties for the renderer. To query OpenGL variables you need to call a function anyway, so having MFC inbetween is not a good idea.

Uh… there’s nothing wrong with using C++ and OpenGL. In fact, I thing using an OOD tends to make 3d graphics in general a bit easier.

Generally I’d agree with staying away from MFC if you are doing something like a game. But if you are doing something like a modeller, or some other type of viewer it’s perfectly acceptable, and can make a lot of the windowing stuff easier for you.

OpenGL engine is NOT compatibile with C++ class syntax



While I wouldn’t use MFC in a game engine, the use of OpenGL with MFC is otherwise perfectly harmless in my opinion.

MFC neatly adds an abstraction layer above Windows to make message pump handling easier and provides utility and collection classes among other constructs.

Here’s a simple example of a small program that uses MFC to decode 3D Studio MAX meshes, displaying the mesh with OpenGL:


Good luck,