[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 429
  • Last Modified:

Making a GUI with OpenGL

Hi,
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,

Andy

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.
0
fxnut
Asked:
fxnut
  • 2
  • 2
2 Solutions
 
AlexFMCommented:
Did you learn existing solutions? You may use them directly or as samples for your own development.

http://www.nigels.com/glt/glui/

I am sure you can find more libraries.

0
 
Jaime OlivaresSoftware ArchitectCommented:
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?
0
 
fxnutAuthor Commented:
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?
0
 
Jaime OlivaresSoftware ArchitectCommented:
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:
http://www.gamedev.net/community/forums/topic.asp?topic_id=127418
http://www.gamedev.net/community/forums/topic.asp?topic_id=147223

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

0
 
fxnutAuthor Commented:
Thanks Jaime, the links pointed to the sort of discussion I was looking for.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now