1
\$\begingroup\$

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);
}

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. Example:

enter image description here

font is above the screen

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

How can I invert texture's v-coordinate without modifying its source code ? (assume its read only)

\$\endgroup\$
3
  • \$\begingroup\$ "without modifying its source code" -- the source code of what; your program? How do you expect to fix the problem then? \$\endgroup\$
    – Anko
    Commented Mar 1, 2014 at 22:57
  • \$\begingroup\$ @Anko the source code of FTGL. By inverting the texture v-coordinate. \$\endgroup\$
    – mr5
    Commented Mar 2, 2014 at 0:03
  • \$\begingroup\$ Cross posted: stackoverflow.com/questions/22111457/… \$\endgroup\$
    – House
    Commented Mar 4, 2014 at 14:50

1 Answer 1

0
\$\begingroup\$

I have no experience with FTGL, but after some Googling I found this: http://devcry.heiho.net/2012/01/opengl-font-rendering-with-ftgl.html?m=1

Basicaly when using glOrtho with the rendering, you should set the origin to the lower left corner. I hope this helps.

\$\endgroup\$
5
  • \$\begingroup\$ Thanks for the answer man but, as I said in my post, I like the top-left corner of the window to be the origin. \$\endgroup\$
    – mr5
    Commented Mar 3, 2014 at 0:01
  • \$\begingroup\$ Then switch it just temporarily when you draw the text and then return to the topleft origin. \$\endgroup\$
    – user42556
    Commented Mar 3, 2014 at 6:20
  • \$\begingroup\$ Its not a good practice. Anyway, I just solved it \$\endgroup\$
    – mr5
    Commented Mar 3, 2014 at 7:51
  • \$\begingroup\$ @mr5 Please do write an answer with a quick summary describing how the problem was solved. \$\endgroup\$
    – Gerstmann
    Commented Mar 3, 2014 at 10:49
  • \$\begingroup\$ @da4c30ff Its on the link, or if unnoticeable, here \$\endgroup\$
    – mr5
    Commented Mar 3, 2014 at 11:45

Not the answer you're looking for? Browse other questions tagged .