The code provided by Anotherjake works well in Ortho mode. But in full 3D the text looks bad when put close ( eg. glTranslatef(0, 0, -50); ). The text looks good from a distance about -150, but then it's covered by other objects on the screen. What's the solution for this?

twig0 Wrote:The code provided by Anotherjake works well in Ortho mode. But in full 3D the text looks bad when put close ( eg. glTranslatef(0, 0, -50); ). The text looks good from a distance about -150, but then it's covered by other objects on the screen. What's the solution for this?

Probably because it's a pretty small texture to begin with. You can try making a bigger texture and render a larger font for more resolution. Maybe try something like:

I have successfully used AnotherJake's code from the post dated 12/27/2008. My end goal is to have individual 2D images rotate, translate and scale. To simplify, I will show code below that only tries to rotate the text. I have only added four lines to the original code: glPushMatrix, glLoadIdentity and glRotatef (20 degrees) before drawing the text, and a glPopMatrix after drawing the text. Here is the code:

When running this code, the "TEST" text appears to be rotating around the bottom left corner. For example, at 20 degrees it is moved above the vertical center and to the left of center. How can I change the code so that the "TEST" text only rotates in place and at the center position?

AnotherJake Wrote:Probably because it's a pretty small texture to begin with..

Thanks for your prompt reply. Changing those dimensions didn't help much, but using drawInRect instead of drawAtPoint solves the problem - the text looks nice then.

I'm having problem drawing a textured text - maybe it works only in Ortho mode? Or maybe I can't see the texture because I'm working on Powerbook G4, where all the graphics don't look like they should. Looks like it's high time to buy an Intel MAC.

Anyway textured font is not what I need, I'd like to have an outlined text. Looks like I'm gonna have to take a deep look into the Texture2D.h. Or maybe there's already a nice method to draw an outlined text?

Splat21 Wrote:When running this code, the "TEST" text appears to be rotating around the bottom left corner. For example, at 20 degrees it is moved above the vertical center and to the left of center. How can I change the code so that the "TEST" text only rotates in place and at the center position?

Any assistance would certainly be appreciated.

It's probably because Texture2D is calculating coordinates based upon the location you give it, so it's not transforming as you expect. Try doing it like this instead:

twig0 Wrote:I'm having problem drawing a textured text - maybe it works only in Ortho mode? Or maybe I can't see the texture because I'm working on Powerbook G4, where all the graphics don't look like they should. Looks like it's high time to buy an Intel MAC.

Textured text should work just fine on your PB G4 too, although it's not a bad idea to upgrade to an Intel machine now. Ortho or perspective works fine, but ortho probably yields more predictable results. This snippet of code was for iPhone, although it can be used elsewhere. Texture2D might have some stuff in it that only works with iPhone, I don't know.

twig0 Wrote:Anyway textured font is not what I need, I'd like to have an outlined text. Looks like I'm gonna have to take a deep look into the Texture2D.h. Or maybe there's already a nice method to draw an outlined text?

Ingemar was working on this a while back. You might be able to pester him for a little help.