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

Aktuelle Zeit: So Mai 26, 2024 20:32

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



Ein neues Thema erstellen Auf das Thema antworten  [ 2 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Texture and squares,lines etc
BeitragVerfasst: Sa Mai 26, 2007 09:47 
Offline
DGL Member

Registriert: Sa Mai 26, 2007 08:55
Beiträge: 1
Hi,

first I want to say that I consider myself a beginner with OpenGL even though I already developed some OpenGL application for the flight simulation world.
To be specific I developed the replica of several onboard instruments (called glass cockpit, that you can see in my web site) using bitmap textures 256x256 in size (also bitmap font textures) to draw the "appearance" of the instruments.
Now I want to rework the instruments getting rid of most of the textures that seems to slow down the execution of the programs.
To draw, for example, the artificial horizon I want to use lines, rectangles, circles etc continuing to use bitmap font textures.
The problem seems to be in the intialization of OpenGL:
if I use

Code:
  1.  
  2.   glShadeModel(GL_SMOOTH);
  3.   glClearColor(0.0, 0.0, 0.0, 0.5);
  4.   glClearDepth(1.0);
  5.   glEnable(GL_DEPTH_TEST);
  6.   glDepthFunc(GL_LEQUAL);
  7.   glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
  8.  
  9.   glEnable(GL_BLEND);
  10.   glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  11.   glEnable(GL_POINT_SMOOTH);
  12.   glEnable(GL_LINE_SMOOTH);
  13.   glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
  14.   glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
  15.  


then I can't see the font textures anymore, I just see a coloured rectangle in the place of the texture.
If I use

Code:
  1.  
  2.   glShadeModel(GL_SMOOTH);
  3.   glClearColor(0.0, 0.0, 0.0, 0.5);
  4.   glClearDepth(1.0);
  5.   glEnable(GL_DEPTH_TEST);
  6.   glDepthFunc(GL_LEQUAL);
  7.   glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
  8.  
  9.   glEnable(GL_TEXTURE_2D);
  10.   glEnable(GL_BLEND);
  11.   glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  12.   glEnable(GL_POINT_SMOOTH);
  13.   glEnable(GL_LINE_SMOOTH);
  14.   glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
  15.   glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
  16.  


(I added the glEnable(GL_TEXTURE_2D) ) then I can see the font textures but not lines, rectangles etc.
Which is the correct initialization to make both things appearing?
Thank you, regards.

Roberto


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 26, 2007 11:05 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
There is no perfect initialisation that works for the whole running time of you programm. OpenGL is an state machine. If you enabled textures the will used for everywhere. Including lines etc. It draws the pixel of the last texturecoordinate over all.

So you must call glEnable(GL_TEXTURE_2D); if you want to use textures and glDisable(GL_TEXTURE_2D); if you want to draw something without textures.

PS: The same to all other settings. Like blending. If you draw many polygons without any alphavalues its not necesarry to have GL_BLEND enabled all the time. Modern graphiccards dont care about but its not necesarry. And perhaps if you have really much polygons they have any effect on the speed.


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


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 12 Gäste


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.008s | 14 Queries | GZIP : On ]