iDevGames Forums
2D Control Buttons on Top of 3D OpenGl. - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: 2D Control Buttons on Top of 3D OpenGl. (/thread-732.html)



2D Control Buttons on Top of 3D OpenGl. - Bersaelor - Sep 23, 2009 09:10 AM

I have another question to ask you guys!

I have a nice 3D Scene which is leaving the corners of the Iphone free.
Now I wanna place some 2D-Buttons there, looking a bit like a HUD.

What is the preferred way to do something like this?
I understand there'll probably be many games using this since it seems quiet natural.

My first 2 guesses were
  • a special 2D Layer on top of OpenGL 3D
  • some Triangles facing the Screen, that are incorporated into my 3DScene, having textures that look like the buttons

Which way is more natural or less Performance heavy?
Or are there even some Demo-Apps out there who do exactly this?

I searched for it, but couldn't really find anything that adressed this issue.


2D Control Buttons on Top of 3D OpenGl. - Skorche - Sep 23, 2009 09:56 AM

Putting Cocoa buttons over your GL view will take a pretty hefty performance cost. It's easy enough to try, but you probably don't want to go that route.

The usual way is just to draw your scene using your normal method, then draw the UI/HUD using an orthographic camera projection with depth testing disabled.