View Full Version : help ,how to use glut in MFC

06-13-2004, 01:13 AM
who can tell me how to use glut in MFC?

06-13-2004, 01:26 AM
it will be awkward to use glut with mfc, since glut drives the message pump, and mfc wants to do this too, by default.

i would suggest creating your own render context with mfc, since it wraps up all the ui stuff anyway. wouldn't be much point in using glut there.

06-13-2004, 06:31 AM
Thank you very much.
But I want to write a programme that can obtain the SUB of two objects.I have seen sb`s programme write with GLUT.but I must use MFC,so I don`t know how to program it.

06-13-2004, 02:02 PM
See WGL (Windows OpenGL Extensions) functions such as wglCreateContext, wglMakeCurrent, etc. Do a Google search, this FAQ, etc. and you'll find numerous examples of OpenGL and MFC.

06-13-2004, 04:06 PM
You cannot do this with GLUT. You can use MFC quite easily with OpenGL using WGL to greate a context from the HDC but MFC is fundamentally incompatible with GLUT because of the glutmainloop requirement.

06-14-2004, 12:08 AM
This (http://www.gamedev.net/reference/articles/article1358.asp) article might be of use to you, it certainly was of use to me! :)

06-14-2004, 12:36 AM
nice link. i didn't see the render context init though. maybe it's in the source distribution. usually do that in the OnCreate() and PreCreateWindow() methods (very important).