The OpenGLs coordinate system is not really based on pixels, but on who decides what the points are. The context defines the coordinate system in 2D with the glOrtho function (or you can build the ortho matrix manually), which sets the min and max x, y coordinates on the screen. For example, the orthographic projection can be adjusted so that 0 is on the left of the screen, and 100 is on the right, regardless of the size of the framebuffs rendering.
The font texture is created just fine. The problem is that you are rendering it in geometry twice as much as you need. In OpenGL, the size of the texture does not affect the size of the object displayed on your screen. The size on the screen is determined by the geometry passed to glDrawArrays or glBegin , etc., and not the texture.
I think the problem is that you are using the pixel size of the font texture to determine the size of the square used to render on the screen. This will put your problem in a "different OpenGL drawing code." To fix this, you can apply some scale factor to the drawing. In retina mode, the scale factor is 0.5, and for regular screens - 1.0 (UIKit uses a similar idea to display the contents of the UIView)
A square calculation might look something like this:
quad.width = texture.width * scaleFactor quad.height = texture.height * scaleFactor
Another option is to completely separate the quad rendering size from the texture. If you have a function or class for drawing text, it may have a font size parameter that it will use as the actual size of the square instead of using the texture size.
source share