@Lossy
Zitat:
Evtl solltest du auch noch erwähnen um was es sich handelt bzw einen Link darauf. Denn noch ist die Bibliothek recht unbekannt.
Ja hätte ich tun sollen
Ist klar das es nicht so einfach wie glPrintBitmap ist.
Das ist auch mein problem.
Mein problem
Ich möchte wie bei glPrintBitmap die x und y position zur 'gluPerspective' erhalten
bedeutet dass ich muss erst in den 'glOrtho' modus schalten und dann wieder zurück
so wie bei glPrintBitmap ?
Dachte ein einaches
Delphi-Quellcode:
glTranslatef(10, PlaystateYPos, 0);
tsTextOutA(SongName);
würde reichen scheint aber nicht so zu sein.. muss dann wohl noch selbst in
'glOrtho' wechseln um die Positionen zu setzen
Habe mit deinen SimpleLine example experimentiert aber die zeile hat sich
nie auf die von mir angegebene position gesetzt.
Vielleicht bin ich auch zu doof dafür
EDIT:
Damit das hier
Delphi-Quellcode:
glTranslatef(10, PlaystateYPos, 0);
tsTextOutA(SongName);
überhaupt funktioniert mache ich jetzt folgendes
Beide Funktionen kapsel ich in eine extra procedure.
Delphi-Quellcode:
procedure glPrintXY(x, y : GLFloat; fWidth, fHeight: GLFloat; text : pchar; fontset : tsFontID; Textalign: Integer);
begin
tsFontBind(fontset);
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
glOrtho(0,640,0,480,-100,100);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix(); // Store The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
glTranslated(x, y, 0); // Position The Text (0,0 - Bottom Left)
glScalef(1, -1, 1);
tsSetParameteri(TS_ALIGN, Textalign);
tsTextOutA(text);
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPopMatrix(); // Restore The Old Projection Matrix
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPopMatrix(); // Restore The Old Projection Matrix
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
end;
und rufe sie hier auf
Delphi-Quellcode:
procedure TMainForm.FormPaint(Sender: TObject);
begin
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(45, ClientWidth / ClientHeight, 4, 256);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
// setting color or with glColor
tsTextColor3f(1, 1, 1);
glPrintXY(15,
13,
ClientWidth,
ClientHeight,
'TextSuite Sample - Single Line',
fLargeFontID,
TS_ALIGN_LEFT);
// Check for Errors
CheckError;
SwapBuffers(fDC);
end;
Delphi-Quellcode:
procedure TMainForm.FormResize(Sender: TObject);
begin
if fInitialized then begin
ReSizeGLScene(ClientWidth , ClientHeight);
FormPaint(Self);
end;
end;
Delphi-Quellcode:
procedure ReSizeGLScene(glsWidth : GLsizei; glsHeight: GLsizei);
begin
If glsHeight = 0 Then // Prevent A Divide By Zero By
glsHeight := 1; // Making Height Equal One
glViewport(0, 0, glsWidth, glsHeight); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity; // Reset The Projection Matrix
gluPerspective(45, glsWidth / glsHeight, 1, 1000.0);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity; // Reset The Modelview Matrix
End;
Frage mich jetzt nur warum ich so einen umweg machen muss um den Text zu positionieren
Welchen vorteil hat dann die TextSuite wenn es nur so umständlich geht ?
Der gerenderte Text ist auch unansehnlich.
Oder was mache ich falsch das es so ist.
In 320x240 sieht man gar nichts obwohl der Font eine größe von 14 hat.
In 1280 ist zu groß und total unansehnlich.
gruss Emil