PDA

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



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

06-13-2004, 12: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.

greatlht
06-13-2004, 05: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.

brcain
06-13-2004, 01: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.

dorbie
06-13-2004, 03: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.

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

06-13-2004, 11:36 PM
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).