Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mo Sep 21, 2020 13:11

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Mo Jan 16, 2017 07:35 
Offline
DGL Member

Registriert: So Jan 15, 2017 18:52
Beiträge: 14
Programmiersprache: Delphi
Dear DelphiGL community.

Can you help me with one TextSuite problem (http://www.dev-center.de/projects/textsuite). This tool is easy to implement but when I call text drawings, my whole 3D models (created before and after) dissapears. I can see only text generated by TextSuite but background is black all over the screen. But Camera movement and rotation works.

I will try to type out my OpenGL code below:

Code:
  1.  
  2. > START OF THE RENDERING
  3.  
  4.   if (CanvasWidth <> Canvas.ClientWidth) or (CanvasHeight <> Canvas.ClientHeight) then ReCreate;
  5.   ActivateRenderingContext(DC, RC);
  6.  
  7.   SetAntiAliasing;   // ON
  8.   SetBlend;           // ON
  9.   SetDepthTest;     // ON
  10.   SetFaceCulling;   // ON
  11.   SetLights;          // ON
  12.   SetFog;             // OFF
  13.  
  14.   glClearColor(r, g, b, w); // BLACK COLOR
  15.   glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  16.  
  17.   glLoadIdentity;
  18.  
  19.   // CAMERA
  20.   gluLookAt(CameraPosX, CameraPosY, CameraPosZ, CameraPosX + CameraViewX, CameraPosY + CameraViewY, CameraPosZ + CameraViewZ, CameraUpX, CameraUpY, CameraUpZ);
  21.  
  22.   // SCENE
  23.   glRotatef(RotateZ, 0.0, 0.0, 1.0);
  24.   glRotatef(RotateY, 0.0, 1.0, 0.0);
  25.   glRotatef(RotateX, 1.0, 0.0, 0.0);
  26.   glTranslatef(TranslateX, TranslateY, TranslateZ);
  27.   glScalef(ScaleX, ScaleY, ScaleZ);
  28.  
  29.   // SAVE FOR LONGER USE
  30.   glGetDoublev(GL_PROJECTION_MATRIX, @ProjectionMatrix);
  31.   glGetDoublev(GL_MODELVIEW_MATRIX, @ModelViewMatrix);
  32.   glGetIntegerv(GL_VIEWPORT, @ViewPortMatrix);
  33.  
  34. > DRAWINGS SOME 3D OBJECTS
  35.  
  36.   //DRAWINGS TEXTSUITE TEXT
  37.   tsTextColor3f(r, g, b); // RED COLOR
  38.   glDisable(GL_LIGHTING);
  39.   glPushMatrix;
  40.   glTranslatef(v.X, v.Y, v.Z);
  41.   tsTextOutW(PWideChar(WideString(text)));
  42.   glPopMatrix;
  43.   glEnable(GL_LIGHTING);
  44.  
  45. > DRAWINGS SOME 3D OBJECTS
  46.  
  47.   SwapBuffers(DC);
  48.  
  49. > END OF THE RENDERING
  50.  
  51.  


Thanks for help!
SpaM


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Di Jan 17, 2017 08:46 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
Are your objects using textures?

If they are not using textures, it is possible that the text suite enables texturing and it stays enabled after the textsuite finishes. In that case, texturing would still be enabled for your objects, breaking their rendering. Try disabling texturing after textsuite finishes drawing.

best regards,
Horazont

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Di Jan 17, 2017 09:44 
Offline
DGL Member

Registriert: So Jan 15, 2017 18:52
Beiträge: 14
Programmiersprache: Delphi
Lord Horazont hat geschrieben:
Are your objects using textures?

If they are not using textures, it is possible that the text suite enables texturing and it stays enabled after the textsuite finishes. In that case, texturing would still be enabled for your objects, breaking their rendering. Try disabling texturing after textsuite finishes drawing.

best regards,
Horazont


That was it!! Thanks!! ... at this moment I can see all scene with text. But text is drawn in small quads (see picture attached). Because I never use textures in OpenGL I am totally lost. Can you please help me with this too?

Thanks!


Dateianhänge:
example.png
example.png [ 32.42 KiB | 2973-mal betrachtet ]
Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Di Jan 17, 2017 19:29 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
The texture of the quads has an alpha channel (transparency), but it is not applied (correctly).

You should read about blending, specifically how to enable it and the aspects of transparency sorting.

If you have follow-up questions, feel free to open a new thread :).

best regards,
Horazont

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Mi Jan 18, 2017 08:01 
Offline
DGL Member

Registriert: So Jan 15, 2017 18:52
Beiträge: 14
Programmiersprache: Delphi
I finally made it. Problem was I draw text in middle of whole rendering. If I render text at the end, all work perfect.

Thank you!


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.040s | 19 Queries | GZIP : On ]