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:
glShadeModel(GL_SMOOTH);
glClearColor(0.0,0.0,0.0,0.5);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
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:
glShadeModel(GL_SMOOTH);
glClearColor(0.0,0.0,0.0,0.5);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
(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.
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.
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.