PDA

View Full Version : Text Q



Mrwb
17-08-2003, 11:12 PM
Are there any way besides using the GLXFont component to display a string of text on the screen using GLXTreem?

Andreaz
18-08-2003, 10:11 AM
Except from having text as images and displaying them that way, no, there's however one other way of printing fonts in opengl, lesson #13 on NeHe, however they're not 100% accurate with GLXTreem's surfacewidth and surfaceheight parameters.

Mrwb
18-08-2003, 03:30 PM
oh, I see. thanks for the reply :) *reads lesson *13*

BTW: any good suggestions on how to create text effects such as fade out, deformation etc?

Andreaz
28-09-2003, 12:09 PM
oh, I see. thanks for the reply :) *reads lesson *13*

BTW: any good suggestions on how to create text effects such as fade out, deformation etc?

Sorry, missed the btw before, here's some tips for text effects:

Fading:

GLXFont1.Items[0].Color.Alpha:= Sin(GLXTimer1.ElapsedTime / 1000);
GLXFont1.Items[0].TextOut(0,0, Text);


Deformation - Horisontal scale;

glPushMatrix();
glScalef(Sin(GLXTimer1.ElapsedTime / 1000),1,1);
GLXFont1.Items[0].TextOut(0,0, Text);
glPopMatrix();


Deformation - Per character rotation (really cool):

var Text: String;
var Counter: Integer;

glPushMatrix();
glTranslatef(0,64,0);
For Counter:=1 to Length(Text) do begin
glPushMatrix();
glScalef(1, Sin(GLXTimer1.ElapsedTime / 1000 + Counter / 10),1);

GLXFont1.Items[0.TextOut(GLXFont1.Items[0].TextWidth(Copy(Text,1, Counter)),0,Text[Counter]);
glPopMatrix();
end;
glPopMatrix();

Mrwb
28-09-2003, 02:16 PM
Nice! Thanks! :)