Opengl ES: drawing text

Apprentice
Posts: 6
Joined: 2008.12
Post: #1
I'm trying (and trying and trying) to draw some text on screen using the Texture2D class. The result I have is just a green square on screen, with no text displayed. Googling around I found other guys with the same problem, but no response on how the solved it.
Can someone help please ?

Here is my drawView:

Code:
Texture2D* _textures[1];
    _textures[0] = [[Texture2D alloc] initWithString:@"0123456789" dimensions:CGSizeMake(1,1) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:12];
    
    //Set up OpenGL projection matrix
    glMatrixMode(GL_PROJECTION);
    glMatrixMode(GL_MODELVIEW);
    
    //Initialize OpenGL states
    //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glClearDepthf(1.0f);
    
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
    glViewport(0, 0, backingWidth, backingHeight);
    
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glLoadIdentity();
        glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -10.0f, 10.0f);
        glMatrixMode(GL_MODELVIEW);
    
    glTranslatef(0, 0, -9);
    glColor4f(0.0f,1.0f,0.0f,1.0f);//Change the object color to green
    glBindTexture(GL_TEXTURE_2D, [_textures[0] name]);

    //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    [_textures[0] drawAtPoint:CGPointMake(0, 0)];
    //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL Cube drawing: VBOs, instanced geometry, octrees Symbol$ 5 9,088 Dec 23, 2011 01:43 PM
Last Post: Skorche
  Drawing menu versus drawing game johncmurphy 4 4,290 Jan 6, 2010 09:14 AM
Last Post: AnotherJake
  OpenGL ES : Drawing Text... savage 8 10,052 Jan 4, 2010 08:59 PM
Last Post: alerus
  openGL n00b looking for FBO drawing examples or direction auptown 5 7,216 Nov 4, 2009 02:16 AM
Last Post: Eskema
  Drawing shapes opengl es jjslay 2 4,090 Aug 14, 2009 11:07 AM
Last Post: jjslay