Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Making a GUI with OpenGL

Posted on 2004-11-02
Medium Priority
Last Modified: 2013-12-03
I'm looking for more of a discussion on this one rather than a specific solution. Basically, I'm looking to write a largely platform independent user interface using OpenGL as a base to render the various controls and windows. The main question/debate is is this a viable solution?

What I'm considering is using a similar method to how Windows works (i.e. using update regions, message maps to windows, etc), but making sure that I restrict the API calls to a small set which I can replace on a platform by platform basis in a seperate source file, with pretty much all of the graphics work being done using OpenGL. I want to be able to implement most of the standard windows controls (edit boxes, list boxes, etc), as well as writing something to allow windows and toolbars to be docked.

One aspect I'd like discussed is that I was planning on making the interface as fast as possible by using glReadPixels to cache the drawing of the rendered OpenGL windows to enable them to be dragged around, resized, etc. as fast as possible by either rendering the cached pixels as a texture, or by directly blitting the pixels to the window (the second option probably not being such a good idea for platform independence). The general idea is that this method would limit the amount of redraw and hopefully make the whole thing fairly fast. Then again... it might just cause slowdown if there are too many textures being created and thrown around in general. I don't know, hence this question.

Is this a good way of going about doing things, or does anyone have any better ideas?

The reason I want to use OpenGL is for various reasons:

 - easy portability across platforms if it becomes necessary later on
 - maximum control over the look and feel of the GUI (rather than using MFC as a base)
 - total customisability - to allow for easy creation of various application specific controls
 - to avoid the complexity of, say, writing ActiveX controls and getting into the whole ATL side of things
 - to allow for maximum integration into any 3D viewports that I create

I'm looking for general feed back on these issues. Anyone raising negative issues on this direction of development will be just (if not more) as likely to receive points awarded to them. Don't hold back!

Many thanks,


P.S. In case anyone noticed, I posted this previously in the OpenGL area. I didn't get any responses, so I deleted the original question and moved it here - I think this is probably a more appropriate Topic Area to post it in. I hope there's no problem with doing that.
Question by:fxnut
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 48

Assisted Solution

AlexFM earned 400 total points
ID: 12471683
Did you learn existing solutions? You may use them directly or as samples for your own development.


I am sure you can find more libraries.

LVL 55

Expert Comment

by:Jaime Olivares
ID: 12472498
OpenGL functions to manipulate bitmaps are really messy, and you have to pay attention to scaling options. I think openGL won't make a fast job for a traditional 2D GUI.
Have you considered to use a portable GUI library like QT or wxWindows?

Author Comment

ID: 12488291
Thanks for the GLUI link Alex. That could be pretty helpful for seeing how he implemented that. I'd be looking to do something similar.

Jaime, I'd partly dispute what you said regarding speed, since I've done some tests with writing a Node graph editor and didn't find it caused too many problems. I was preferably looking for an answer in terms of performance with regards to the caching issue I mentioned in my first post. Scaling and bitmaps won't be much of a problem, since the majority of the bitmaps I'll be using will be for text (i.e. unscaled). BTW, QT doesn't offer a downloadable trial for Windows, so that's a no-go option.

Anyway, I don't really want to use a third party library since I may want to use the software in a variety of ways (commercial or otherwise), and I don't think that any of the various GPL based licenses would accomodate that. But thanks for the suggestions.

Can anyone comment a bit more about how feasible the project I mentioned above is? What pitfalls I may encounter?
LVL 55

Accepted Solution

Jaime Olivares earned 1600 total points
ID: 12488833
Well, it is totally feasible, AlexFM's link is proof of that. But as I said to you, OpenGL is a bit messy handling bitmaps, because its paradigm is texture-oriented.
Read some discussions about that:

There is another ready made GUI lib at sourceforge.net:


Author Comment

ID: 12491949
Thanks Jaime, the links pointed to the sort of discussion I was looking for.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question