0
votes

What I'm trying to achieve is something like this - that is, an OpenGL view contained in a standard window, alongside some buttons, menus, etc.

However, I'm trying to use non-managed C++ and WinAPI to accomplish that (project requirements), and, if possible, (free)GLUT.

However, it seems to me that the only thing possible using GLUT is to create a separate window. Am I right, or is there actually a way to pass a window handle to GLUT for rendering? Or am I completely off the track?

1

1 Answers

2
votes

Yeah, as far as I am aware GLUT only lets you do full-blown windows and will not let you paint into an arbitrary rectangle. There are a number of tutorials on setting up a render context in Windows using nothing but the Win32 and WGL APIs. Once you get your context setup, you can effectively do everything the same way you would with GLUT, but use the appropriate WGL function for swapping buffers.

Here's a high-level overview of what would be involved, though it's really text-heavy and related to MFC it outlines the whole process. You should be able to lookup the appropriate WGL API reference to implement this.

There's really no point in using GLUT if you've already decided to use the Win32 API to be honest, it is going to try to hide everything from you including the message pump that you'll need to handle dialog initialization and button events. If your requirements weren't limited to Win32 API, I would suggest something a little more portable like Qt for a framework that's dialog-friendly and supports OpenGL.