0

I just use FTGL to use it in my app. I want to use the version FTBufferFont to render font but it renders in the wrong way. The font(texture?buffer?) is flipped in the wrong axis.

enter image description here

I want to use this kind of orthographic settings:

void enable2D(int w, int h)
{
    winWidth = w;
    winHeight = h;

    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //I don't even want to swap the 3rd and 4th param
    //because I like to retain the top-left as the origin
    glOrtho(0, w, h, 0, 0, +1);
    glMatrixMode(GL_MODELVIEW);
}

And I want the window origin to be top-left

I render the font like this:

//No pushing and popping of matrices
//No translation

font.Render("Hello World!", -1, position, spacing, FTGL::RenderMode::RENDER_FRONT);

On the other forums, they said, just scaled it down to -1, but it wont work in mine

I can't see relevant problem like in mine in google so I decide to ask this here again.

Update:

How can I flip its axis in a proper way. I can think of like editing the source code and flip the texture coordinates but its not good.

I really need a quick fix..

mr5
  • 3,438
  • 3
  • 40
  • 57
  • @AndonM.Coleman What do you mean by sale the texture matrix? Do you mean like, uploading a matrix in OpenGL? – mr5 Mar 01 '14 at 07:35
  • @AndonM.Coleman It just gone out of the screen...? I got a gl error code of `1284` ? – mr5 Mar 01 '14 at 07:40
  • Is the glyph map itself upside down? Your original description of flipping the Y-axis in the projection matrix is what lead me to believe that "Hello World!" was supposed to be on the bottom of the screen. Thus, I gave you a solution that flips the T axis of the texture coordinates. Your error (**0x0504** - Stack Underflow) is not related to anything I suggested. – Andon M. Coleman Mar 01 '14 at 07:45
  • @AndonM.Coleman I think it is. That's almost all the settings I changed. Any other way I could flip those? Your solution was awful I think? – mr5 Mar 01 '14 at 07:51
  • @AndonM.Coleman Okay, I need to wait for you again. have a good sleep :D – mr5 Mar 01 '14 at 08:20
  • You could try using a traditional orthographic projection matrix where (0,0) is the bottom-left and the Y-axis moves in a positive direction from bottom to top, but translate your coordinate system so that (0,0) is moved to the top. Then the bottom would be (0,-h) instead of (0,h). This would mean if you wanted your text to begin at the top of the screen, set its Y coordinate to `font.LineHeight ()`. This is necessary since I cannot see any way to tell FTGL to draw texture mapped fonts upside down. – Andon M. Coleman Mar 01 '14 at 18:21
  • @AndonM.Coleman Do you mean like this: `glOrtho(0, w, h, 0, 0, 1); glTranslatef(x, y + font.LineHeight(), 0);?` Yeah, I got it working. If you could think of any other way please tell. You could post this as an answer so I could accept it. Thanks again :D – mr5 Mar 02 '14 at 00:14

0 Answers0