Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
Hi, I am having trouble doing very basic things for an iPhone program. I started with an OpenGL ES Game template when selecting new project. I want to just display text on the top left corner of the screen along with the spinning square, or better yet, instead of it. Where does the program draw things to the screen and how would i be able to dynamically change what is displayed on screen from within the AppDelegate class.
 

SqueegyX

macrumors regular
Mar 24, 2008
108
1
The code would go in EAGLView class, if you are using the OpenGLES template. The drawView method gets called 60 times per second. THis is where the magic happens.

And I don't think OpenGL has any native support for text, but I could be wrong about that.
 

gruddlebug

macrumors newbie
Sep 13, 2008
7
0
Hello,

The Apple Crash Landing example does it.

You could use the Texture2D class from that

cheers

evs
 

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
The animation happens 60 times a second, but I'm trying to get the animation to happen only when I want it to happen based on user action/game rules. I'm building the game rules in the App Delegate, so how do I stop the animation from automatically continue on its own, to controlling it within my gameLogic method in App Delegate?
 

RPGamerL99

macrumors newbie
Original poster
Mar 10, 2008
18
0
wouldn't this work for displaying text?

Code:
[myText drawAtPoint:CGPointMake(0.0,0.0) withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];
 

fat phil

macrumors 6502
Jul 11, 2008
438
0
You'd have to draw the text into a texture.

The crashlanding example mentioned by gruddlebug does this by creating a CGBitmap context and writing on this, then pushing it out as a texture.

Note this isn't something you want to do for realtime text updates, so you'll want to write your own routines to work with a bitmap font (tpage) if you're thinking of anything that will liable to change every frame.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.