OK, I can easily produce a single GL window with virtually any options, and render a 3D world. Now I am working on a system to create child windows in my fullscreen GL application. These windows will be used for displaying text, images, and all kinds of other things in-game. However, I need some answers before I go too far with the GL class modifications.
I assume I have to get a rendering context for every child window so that I can manually draw the border, title, and contents. Is this correct?
Let’s say I have my main window and four child windows up (think about the Morrowind menu in-game that shows stats, inventory, magic, and map). Do I somehow have to draw one window, switch rendering contexts to another, draw it, and so on until each is drawn?
Actually, I’ll wait for those answers before I post the others, as these will determine how I handle the rest. Thanks for the info.
No, you dont need to get a separate rendering context for your “windows”. If you know how to draw a 2D quad, then you should be able to figure out how to draw a “window”. If you are wanting to have windows with 3D views in them, you can set up their viewport with glViewport.
As far as I can tell, the windows in Morrowind are not different rendering contexts. The engine just draws them like any other 2D graphics within the main rendering context.
The windows in MW are actual Windows, but DX allows you to draw custom borders and such. What I was trying to do in GL was create an actual child window (button, text-edit, whatever) and then manually draw it with GL. If that’s not how you make up menus and the like in GL, how is it done?
If you wanted actual child Windows, you do have to have a new Window handle, Device Context, and Rendering Context. However, as was mentioned in the earlier post, A textured quad would work fine for what (I think) you’re trying to do.
Sephiroth, I’ve made my own library for doing GUI controls and stuff. Every GUI control is derived from a Panel class. A panel is just a rectangle on the screen which can have visual properties like colors, textures, and borders. Every panel can also have child panels, and has input handling capabilities. For specific types of controls, I use derived classes. For instance, I have a button class which is derived from my Panel class, etc. I dont use separate rendering contexts to draw them, I just draw textured quads.
I’ve thought about doing that, but since GL is primarily 3D, how would I go about doing a 2D set of windows (well, triangles that look like windows) that always face the right way and appear properly?
If you want to render 2D graphics, use ortho-view. What is the problem?
Sephiroth, you set up an orthographic projection matrix which allows you to draw 2d graphics in screen coordinates.
I’ve never toyed with ortho. I’ll check out the red/blue books and see what I can do. As it is, I’ve put a lot of thinking into using triangles to make up windows and the like, and I can easily do so, but my problem with this method is figuring out when the cursor is hovering over a specific window, when it’s pressed, when it’s released, etc. Is there any easy way to do that? Keep in mind, my windows can be moved and sized, so it may not always be in the same location.