MFC and OpenGL?

Right now I’m just learning MFC, and I was wondering what impact MFC has on OpenGL? Is it compatible with OpenGL? Does it enhance it in Windows? Is it better to use MFC with OpenGL, or better to use OpenGL without MFC? There are too many questions on my mind, so if you know anything about the relation of these two, post it.

1: “Is it compatible with OpenGL?”


2: “Does it enhance it in Windows?”

… Enhance OpenGL? No, MFC has no effect on the function of OpenGL.

3: “Is it better to use MFC with OpenGL, or better to use OpenGL without MFC?”

Define better.

If you doing a lot of Windows oriented stuff (like, for instance, a modeller that uses OpenGL to draw the model, but has a lot of Windows controls, toolbars, etc), then it is better to use MFC because it makes interfacing with Windows easier than using the Win32 API.

However, if you’re writing a high-performance application (like, for instance, a game) that uses precious little Windows interface, then using the Win32 API would be a good idea. MFC, with or without OpenGL, adds some non-insignificant overhead to a program. If you’re dealing with Windows stuff a lot, then the overhead is worth it for what MFC provides. Otherwise, use Win32.


You might have a look at my MFC & OpenGL website.


When I mean better, is it easier to use MFC? For now, I’m planning to learn MFC anyway because I want to do a few Windows Apps with the toolbar stuff, but my main goal is to make a full-screen 3D game like Half-Life or Final Fantasy VIII. I heard you all say something about Win 32. Does that mean I have to learn Windows Programming? I wanted to learn MFC because I didn’t want to do every detail of Windows programming, just the important stuff to get my stuff running. Also, is it possible to take out the toolbars and stuff and use MFC to make a full-screen game w/o toolbars, status bars, etc… I read in my MFC book that it is possible to do that.

If you want to do a fullscreen app, for maximum performance you don’t want MFC. You would do all your drawing with OpenGL, and (I don’t know) all your interaction with DirectInput. Easiest is GLUT, maximum performance is win32/X windows (depends on OS)

[This message has been edited by ffish (edited 06-18-2001).]

There is nothing you can do with MFC that you can’t do in Win32.

Like I said. If the OpenGL program in question is going to interface with Windows a lot, using Windows controls and so forth, then use MFC. If, however, the program is supposed to be a high-performance OpenGL only application where all the Windows stuff is just to setup the window (ie. switching to full screen), then go with straight Windows programming.

And making a skeleton Win32 program isn’t particularly difficult. You won’t have to learn some of the deeper mysteries of Win32 to get a fullscreen app running. And you will not want the framework that MFC provides in a fullscreen game-type app.

Use what is best for the particular program. For instance, I currently work in MFC, because my programs are, for now, just technology tests (testing out bump mapping, height fields, etc). But, when it is time to move into developing a game-type application, I will use a simple Win32 framework.

And NeHe has a pretty good Win32 framework avaliable.

Just confirming what you said, Korval

[This message has been edited by ffish (edited 06-18-2001).]

O I C! The Win 32 thing is just a setup for me so the program can be run in Windows. That’s all it’s really used for right? It’s just a basic skeleton so the OpenGL code has a place to stay. OpenGL does most of the gritty work, so that means I won’t have to learn all there is for Windows programming, just the essentials. And as you said Korval, I can use MFC, but for games full-screen, it’s not recommended except for tests and stuff. THANX!