Jump to content
Site Stability Read more... ×
  • Advertisement

OpenGL Rendering a scene with multiple element

Recommended Posts


I have been practicing the OpenGL tutorials and doing some text rending.  Now its time to build a simple program with various UI components.

The components are basic but  separate.

I have;

  • A 3d  space area where I can rotate around my 3d model
  • I have a text status box at the bottom that informs me of progress / events of the simulation
  • I have filtering boxes at right hand side
  • I summary performance count on bottom right

I have a rough mock up attached.


The question I have is:  

Where can I find information / examples about putting the different elements together, so 3d area scales objects correctly, layout is "owned" by the correct space.

So the separate  components can be rendered in a single scene ?  For example 3d area which say is 80% of the screen area, is still a scaled replication of the 3d model.



All code is in C++/Open GL 3.5










Share this post

Link to post
Share on other sites

I don't know if this will answer your questions, but here are a few ideas.

You can use the viewport (glViewport()) to specify the area of the frame buffer you want to render to. You may need to specify a scissor area as well (glScissor(), GL_SCISSOR_TEST).

If you want the UI areas to be fully independent of the 3d area, rather than just superimposed on it (as seems to be the case based on your description), you could set the viewport/scissor to the upper-left area (in your mockup) for the 3d rendering, and then however you want (presumably to the full frame buffer) for the UI. Typically you'd use a perspective projection transform for the 3d rendering, and an orthographic projection transform for the UI rendering.

It's possible I missed a critical ingredient there somewhere, but it's all doable in principle, so if you run into problems they should be resolvable.

I'm not sure what you mean by the layout being owned by the correct space, but if you need more info (e.g. with respect to transforms, render order, depth testing, etc.), I'm sure someone will be able to help.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!