Drawing Text with OpenGL ES - 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: Drawing Text with OpenGL ES (/thread-2444.html)
Pages: 1 2
Drawing Text with OpenGL ES - bronxbomber92 - Aug 26, 2008 02:08 PM
How do you draw text with OpenGL ES? I need to display the count down of a timer.
Drawing Text with OpenGL ES - AnotherJake - Aug 26, 2008 02:20 PM
Look at the sample code! It's right there, easy as could be.
Drawing Text with OpenGL ES - Najdorf - Aug 26, 2008 02:25 PM
If you want to do it with Cocoa, you have to do it in the usual way, i.e. look at a sample program that works and copy it, because there's no way you'll ever get it working otherwise.
Drawing Text with OpenGL ES - reubert - Aug 26, 2008 02:57 PM
Oh how I love that Texture2D class. It's pretty easy to port it to standard Cocoa too for a nice generic image/text class.
Drawing Text with OpenGL ES - bronxbomber92 - Aug 26, 2008 03:23 PM
Can that load custom ttf fonts?
Edit - I should say, I know it can't so what are my other alternatives?
Drawing Text with OpenGL ES - Skorche - Aug 26, 2008 04:52 PM
I still like texture fonts. They are a bit more of a hassle to create initially, but they are much more flexible style-wise. Instead of just an outline, you can edit the font as an image to texturize or stylize it.
I have a simple 100 line SDL_TTF program that will output a font image and a set of metrics for it. For iPhone ScribBall, I just ran the metrics file through a ruby script that output a VAR with geometry for all the characters packed into it.
Drawing Text with OpenGL ES - bronxbomber92 - Aug 26, 2008 07:27 PM
Thanks! I tried running my font through makefont, but it keeps telling me the font couldn't be loaded. I even tried it with the test parameters you have commented in the file
./makefont /Library/Fonts/VeraMono.ttf 9 1 128 128
I thought maybe I had an old version of SDL_ttf, so I downloaded the latest and recompiled but I'm having the same problem.
Drawing Text with OpenGL ES - Skorche - Aug 26, 2008 11:38 PM
What's the error? I've actually made a font of vera before.
Drawing Text with OpenGL ES - bronxbomber92 - Aug 27, 2008 08:03 AM
There is no error. It just says "Could not load font."
Drawing Text with OpenGL ES - Skorche - Aug 27, 2008 11:23 AM
I guess you could try adding a bit more error checking there. I've yet to run into a TTF font that SDL_TTF couldn't read.
Drawing Text with OpenGL ES - bronxbomber92 - Aug 27, 2008 03:05 PM
Well, I found an old commandline version of Glyph Tool that did the trick for me. Thanks though :-)
Drawing Text with OpenGL ES - wonza - Oct 12, 2008 12:17 PM
Im trying to use the Texture2D class thats included with the crashlander app, but for some reason it just displays a large rectangle with no text:
Drawing Text with OpenGL ES - AnotherJake - Oct 12, 2008 07:02 PM
There are a few things that could be tripping it up. Assuming you have the texture correctly loaded and glBindTextured'ed:
glBindTexture(GL_TEXTURE_2D, [statusTexture name])
Some ideas that come to mind:
Make sure you have these enabled:
I don't know what blend function you'll need, probably either:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) or,
Drawing Text with OpenGL ES - Frogblast - Oct 13, 2008 10:47 AM
Is the texture power-of-two size? It must be to work on the iPhone.
Drawing Text with OpenGL ES - wonza - Oct 16, 2008 03:14 AM
Just to let you know I managed to sort this.. it was an issue with scaling and clipping panes etc. Basically my text was being rendered way off screen and was far far too large Thanks for your help!!