![]() |
GLScene - GLCanvas und TextOut
Hallo,
ich habe ein etwas blödes Problem. Ich will über GLCanvas von GLScene ein paar Linien zeichnen und ein bisschen Schrift ausgeben. Mein Code ist bis jetzt:
Delphi-Quellcode:
Führe ich das nun aus, erhalte ich stehts eine Fehlermeldung 'invalid operation'. Zeichne ich erst die Schrift und dann die Linien erhalte ich diesen Fehler nicht, doch ist dies eine eher unkomfortable Lösung.
procedure TCMP_PLAYLIST.GLDirectOpenGL1Render(Sender: TObject; var rci: TRenderContextInfo);
var OGLCanvas: TGLCanvas; x,y,i: integer; begin x:=GLSceneViewer1.Width; y:=GLSceneViewer1.Height; OGLCanvas:=TGLCanvas.Create(x,y); OGLCanvas.PenColor:=clBlack; OGLCanvas.PenAlpha:=1; OGLCanvas.PenWidth:=1; for i:=0 to 10 do begin GLWindowsBitmapFont1.TextOut(rci,random(100),random(100),'hello',Random(256*256*256)); OGLCanvas.MoveTo(i*10,20); OGLCanvas.LineTo(i*10,y); end; OGLCanvas.Free; end; Wo liegt also mein Fehler, oder ist es anders möglich? GLHudText hatte ich bereits ausprobiert, ist aber leider viel zu umständlich. Ich bedanke mich im Vorraus, Slavik |
Re: GLScene - GLCanvas und TextOut
*schieb*
gar keiner eine Idee? :( Slavik |
Re: GLScene - GLCanvas und TextOut
Liste der Anhänge anzeigen (Anzahl: 1)
Delphi-Quellcode:
procedure TForm1.GLDirectOpenGL1Render(Sender: TObject;
var rci: TRenderContextInfo); var OGLCanvas: TGLCanvas; x,y,i: integer; begin x:=GLSceneViewer1.Width-1; y:=GLSceneViewer1.Height-1; OGLCanvas:=TGLCanvas.Create(x,y); OGLCanvas.PenColor:=clYellow; OGLCanvas.PenAlpha:=1; OGLCanvas.PenWidth:=1; GLWindowsBitmapFont1.TextOut(rci,20,20,'text', clred); for i:=0 to 10 do begin OGLCanvas.StopPrimitive; // <---<<< ruf den mal vorher auf. GLWindowsBitmapFont1.TextOut(rci,random(100),random(100),'hello',Random(256*256*256)); OGLCanvas.MoveTo(i*10,0); OGLCanvas.LineTo(i*10,y); end; OGLCanvas.Free; end; Zitat:
|
Re: GLScene - GLCanvas und TextOut
Super, es klappt!
Ich danke Dir vielmals. Slavik |
Re: GLScene - GLCanvas und TextOut
Hi, OGLCanvas.StopPrimitive; vor der Schleife aufrufen sollte reichen. :gruebel:
|
Re: GLScene - GLCanvas und TextOut
Zitat:
Slavik |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:47 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz