DGL
https://delphigl.com/forum/

undo glTexEnvf settings
https://delphigl.com/forum/viewtopic.php?f=19&t=3220
Seite 1 von 1

Autor:  noeska [ Fr Sep 03, 2004 10:33 ]
Betreff des Beitrags:  undo glTexEnvf settings

How do i undo settings i made with glTexEnvf like:
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB,GL_SRC_COLOR);
is there an easy way to set it back to its defaults? Thanks in advance for your answers.

Autor:  LarsMiddendorf [ Fr Sep 03, 2004 10:48 ]
Betreff des Beitrags: 

Code:
  1. glPushAttrib(GL_TEXTURE_BIT);
  2. glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB,GL_SRC_COLOR);
  3. glPopAttrib;


But I don't know if it is fast.

Autor:  noeska [ Fr Sep 03, 2004 11:02 ]
Betreff des Beitrags: 

That is the way. I should have know that command as i have used it before... :oops: . I did not notice a change in fps, so i suppose it is fast enough.... Thanks!

But i made a little change i do:
Code:
  1.  
  2.   glPopAttrib; //get back default texture state...
  3.   glPushAttrib(GL_TEXTURE_BIT); //save default texture state...
  4.  

I take the risk of getting an error on popping an empty state....

Autor:  Flash [ Fr Sep 03, 2004 15:17 ]
Betreff des Beitrags: 

Do you think a Push...() without a Pop...() is a good idea!? When you do this you minimize your Attributestacksize step by step, don't you?
Read in the Wiki what happens when you Pop from an empty stack. It couses a GLError but this is not that the Problem. A Stackoverflow means you could store nothing more on your Stack. A Underflow yust means the last stackcomand is ignored.

But maybe you meant something else with that code...

Autor:  noeska [ Fr Sep 03, 2004 18:53 ]
Betreff des Beitrags: 

if it is ignored then it is OK. This way things stay clean (no stack overflows). Except i should use a glpopattrib before closing the apllication.
What happens when i do not clear the stack before closing the application, a memory leak?

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/