Skip to main content
gamedev.net
🔒 Locked

OpenGL window

Started by Lord Vader 1 reply 700+ views
Original Post
Lord Vader
Lord Vader
For the application I am making I would like to have the opengl be part of the window, but not the whole thing. I am new to opengl and wasnt able to find any thing that showed what I need. I have buttons and such and I want a opengl window nest it all. I am using the win32 API.
Brother Bob
Brother Bob
If you pass a handle of some window to CreateWindow as parent parameter, the window will be created as a sub-window to the parent. Other than that, and some minor changed to window styles, it's pretty much exactly the same as creating a stand-alone window for OpenGL rendering if I remember correct.
Disgruntled Gamer
Disgruntled Gamer
Do you want to have a single window with opengl rendering on part of it and the other part be able to do hdc drawing or whatever else you want?

Like setting glViewport with something other than the max dimensions of the window? The definition for glViewport says this about width and height:
Quote:

width, height
The width and height, respectively, of the viewport. When an OpenGL context is first attached to a window, width and height are set to the dimensions of that window.

I tried to do what I'm describing once and I got an all black window instead of part of it being white which was my win32 background color. I'm assuming you can't do both opengl drawing and hdc drawing in the same window.

Maybe with offscreen opengl rendering you could do it and just throw the bitmap of your opengl drawing on part of your hdc window. But I have never done offscreen opengl drawing before so this is just a guess.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.