How do I flip upside down fonts in FTGL - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: How do I flip upside down fonts in FTGL (/thread-10915.html)
How do I flip upside down fonts in FTGL - mr5z - Mar 1, 2014 08:03 AM
I just useFTGL 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.
I want to use this kind of orthographic settings:
I render the font like this:
On the other forums, they said, just scaled the y-axis down to -1, but it wont work in mine. Example:
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 y-axis without modifying its source code ? (assume its read only)
RE: How do I flip upside down fonts in FTGL - SethWillits - Mar 1, 2014 10:39 AM
Unless there's a setting in FTGL to flip Y itself, then you'll need to invert Y and offset the origin when drawing text. Not a big deal.
RE: How do I flip upside down fonts in FTGL - OneSadCookie - Mar 2, 2014 11:45 PM
Better yet, avoid FTGL like the plague...
RE: How do I flip upside down fonts in FTGL - arekkusu - Mar 3, 2014 02:06 PM
Quote://I don't even want to swap the 3rd and 4th param
In my opinion, this creates more problems than it solves. Yes, putting the origin at the top left makes intuitive sense, and you can fix the transformation Y inversion in several ways. However there are also several OpenGL API which you can not fix. As soon as you use glReadPixels, glViewport, glScissor, glBlitFramebuffer, glCopyTex[Sub]Image, glCopyPixels, glWindowPos, etc, then the API expects the origin at the bottom left, and you'll have to convert between the two coordinate systems anyway.
It's simpler overall to keep window coordinates in the system defined by the API.
RE: How do I flip upside down fonts in FTGL - JustinFic - Mar 3, 2014 03:36 PM
Quote:In my opinion, this creates more problems than it solves.
I can vouch for this. I did 2D stuff in OpenGL using the top-left as the origin for years, using this exact method to do it.
It was a huge pain in the ass.
Things like text weren't the only thing to get flipped, and I'd have to replace (y) with (1.0-y) and similar things all over my code to get everything looking right, as well as offsetting things downward by their size.
It got so bad that I'd have something get flipped on me, and when I fixed it, the fix would flip like three other things. It was a friggin' nightmare.
I finally switched everything back when I moved back to 3D (which seemed to flip half of everything, randomly) and it hasn't given me problems since. (Although my brain still thinks of positive-y as downward sometimes.)
The sooner you learn to love and work with OpenGL's coordinate system instead of trying to make it work around you, the happier you'll be. Trust me.