No więc tak jak w temacie czyli: jak wyświetlić text w OpenGl'u próbowałem tak jak jest w kursie NeHe ale mi nie działa Sad tzn: przerobiłem to na Delphi (bo troche umiem C++ ) i sie kompiluje ale nic poza tym :/ I teraz prosze o pomoc w tej sprawie. Czy zna ktoś jakąś metode na wyświeltanie textu w Oknie ogl'a, a może ma jakąś (działającą) procedurke ?
Pozdr.
0
0
http://www.sulaco.co.za/opengl.htm
co do NeHe to masz tu kodzik w Delphi, u mnie działa:
http://nehe.gamedev.net/data/lessons/delphi/lesson14.zip
0
function IntToStr(Num : Integer) : String; // using SysUtils increase file size by 100K
begin
Str(Num, result);
end;
function bigletter(c:char):char;
begin
result:=c;
case c of
'a':result:='A';
'b':result:='B';
'c':result:='C';
'd':result:='D';
'e':result:='E';
'f':result:='F';
'g':result:='G';
'h':result:='H';
'i':result:='I';
'j':result:='J';
'k':result:='K';
'l':result:='L';
'm':result:='M';
'n':result:='N';
'o':result:='O';
'p':result:='P';
'q':result:='Q';
'r':result:='R';
's':result:='S';
't':result:='T';
'u':result:='U';
'w':result:='W';
'x':result:='X';
'y':result:='Y';
'z':result:='Z';
'v':result:='V';
end;
end;
function uppercase(s:string):string;
var i:integer; t:string;
begin
t:=s;
for i:=1 to length(t)-1 do
begin
t[i]:=bigletter(t[i]);
end;
result:=t;
end;
{------------------------------------------------------------------}
{ Renders the text to a row of polygons and keeps the origin }
{ in the centre of the string }
{------------------------------------------------------------------}
procedure glImgWrite(strText : string);
var I, intAsciiCode : integer;
imgcharWidth : GLfloat;
imgcharPosX : GLfloat;
begin
imgcharWidth := 1.0/66;
strText := UpperCase(strText);
for I := 1 to length(strText) do
begin
if ord(strText[I]) > 31 then //only handle 66 chars
begin
intAsciiCode := ord(strText[I]) - 32;
//imgcharPosX := length(strText)/2*0.08-length(strText)*0.08 + (i-1) * 0.08; // Find the character position from the origin [0.0 , 0.0 , 0.0] to center the text
imgcharPosX := {length(strText)*0.08}{-length(strText)*0.08}{ +} (i-1) * 0.08;
glBegin(GL_QUADS);
glTexCoord2f(imgcharWidth*intAsciiCode, 0.0);
glVertex3f(-0.04+imgcharPosX, -0.04, 0.0);
glTexCoord2f(imgcharWidth*intAsciiCode+imgcharWidth, 0.0);
glVertex3f( 0.04+imgcharPosX, -0.04, 0.0);
glTexCoord2f(imgcharWidth*intAsciiCode+imgcharWidth, 1.0);
glVertex3f( 0.04+imgcharPosX, 0.04, 0.0);
glTexCoord2f(imgcharWidth*intAsciiCode, 1.0);
glVertex3f(-0.04+imgcharPosX, 0.04, 0.0);
glEnd;
end;
end;
end;