PDA

View Full Version : Need help to render text



Vilo76
05-09-2011, 06:50 AM
Hi all,

I want to render a string of text on-screen using OpenGL (namely Delphi + GLScene).
To render the text itself, i'm using the standard "bitmap font" method (each character glyph is a textured sprite).

The scene is Orthogonal.
The camera's position is (0,0,100) and direction is (0,0,-1).

My problem is about the positioning of the text.
I want my text to be :
- Placed in my scene with 3D coordinates (X,Y,Z).
- Always facing the camera.
- Always horizontal.
- Always the same screen apparent size, whatever :
.the current zoom factor/scene scale
.the actual distance from camera
.the current viewport size

The solution could be to modify GL_MODELVIEW and GL_PROJECTION matrices but I can't find the proper way.
Could you help me please ;o)

Vilo76
05-10-2011, 06:22 AM
Ok, figured it out.
I've found a C++ example that makes exactly what I need, and ported it to Delphi.