I tried both chronozphere and User137 solutions, but none worked.
Hm, I can't understand why it doesn't work. The quads are not displayed. You said the coords may not be right. Here's how I specify them:
[code=delphi]
procedure TBrain2DFont.BuildObject;
const
Txt: String = 'BrainEngine';
Size: Single = 0.025;
Y: Single = 0.0;
var
CurX: single;
Ch: Widechar;
Chaar, I, Ind: integer;
{ .: DrawQuad :. }
procedure DrawQuad(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv, Tv2: Single);
var
V: array[0..3] of TBrainVector;
begin
TexCoords.Add(TexCoord(Tu, Tv));
TexCoords.Add(TexCoord(Tu2, Tv));
TexCoords.Add(TexCoord(Tu2, Tv2));
TexCoords.Add(TexCoord(Tu2, Tv2));
TexCoords.Add(TexCoord(Tu, Tv2));
TexCoords.Add(TexCoord(Tu, Tv));
V[0] := Vec3(-X, Y, Lev);
V[1] := Vec3(-(X + Wid), Y, Lev);
V[2] := Vec3(-(X + Wid), Y - Hgt, Lev);
V[3] := Vec3(-X, Y - Hgt, Lev);
Vertices.Add(V[0]);
Vertices.Add(V[1]);
Vertices.Add(V[2]);
Vertices.Add(V[2]);
Vertices.Add(V[3]);
Vertices.Add(V[0]);
end;
begin
CurX := 0.0;
if (Length(F) = 0) then
exit;
for I := 1 to length(Txt) do
begin
Ch := Txt[I];
Chaar := integer(ch);
if Chaar = 32 then
begin
Ind := -1;
CurX := CurX + SpaceWidth*Size;
end
else
begin
Ind := CharLookup[Chaar];
end;
if ind > -1 then
begin
CurX := CurX + F[Ind].A*Size;
DrawQuad(CurX, Y, F[ind].Wid*Size, F[ind].Hgt*Size, 0.0, F[ind].x1,
F[ind].x2, F[ind].y1, F[ind].y2);
CurX := CurX + F[Ind].C*Size;
end;
end;
end;
[/code]
This code works, but only in the perspective view. The font is displayed correctly: http://i44.tinypic.com/25sara0.png
So what's wrong?
Bookmarks