You can save old state value before changing them using function such as glIsEnabled(), glGetIntegerv(), glGetFloatv() ...
For example: // save curernt state color and lighting GLfloat[4] old_color; GLbolean old_lighting = glIsEnabled(GL_LIGHTING); glGetFloatv(GL_CURRENT_COLOR, old_color) //Do your stuff, including changing color and lightind state ... //restore color and lighting state glColor4f(old_color); if(old_lighting) glEnable(GL_LIGHTING); else glDisable(GL_LIGHTING); 2012/8/2 Peter K.H. Gragert <pkhgrag...@gmail.com> > ok ok, but how to find out the 'original' state, save and restore, with > Python? > > A crash, I did not come across, using bgl ... > > 2012/8/1 Dalai Felinto <dfeli...@gmail.com> > > > > The problem I have right now is that the texture does not display the > > transparency correctly, and that my gui seems to leak on the buttons > (menu > > buttons) of blender spaces/areas/windows . I am now in the process of > > cleaning up my code to make sure I am not doing anything stupid with bgl. > > > > By the way, Blender doesn't set all the necessary opengl states required > to > > draw the UI. If you are playing with bgl, it's kind of up to you to make > > sure you re-set any changed state to its original value. > > > > So this is not necessarily a bug, but more of a consequence of exposing a > > low-level such as bgl > > > > Dalai > > > > 2012/8/1 Campbell Barton <ideasma...@gmail.com> > > > > > On Fri, Jul 27, 2012 at 9:08 PM, dimitris chloupis < > theki...@yahoo.co.uk > > > > > > wrote: > > > > I did not say bgl is buggy , I only said that I am currently > > > experiencing problems I can't isolate with some really weird behavior. > My > > > assumption is that is bugs with my code and not bgl. > > > > > > > > The problem I have right now is that the texture does not display the > > > transparency correctly, and that my gui seems to leak on the buttons > > (menu > > > buttons) of blender spaces/areas/windows . I am now in the process of > > > cleaning up my code to make sure I am not doing anything stupid with > bgl. > > > > > > > > If I find a bug with bgl rest assured I will report it to the bug > > > tracker with an example case attached to it. > > > > > > > > All I am saying is that using bgl can be rather challenging. For > > example > > > using image.gl_load() outside a draw function will crash blender, yet > > there > > > is no such warning in the docs and it looks like a weird behavior > > > image.gl_load() to be contained inside a draw . Doesn't it slow down > > > blender. Attaching a image.gl_free() for example inside the same draw > > does > > > slow down blender considerably. > > > > > > > > So all I am saying bgl can be quite tricky to use. > > > > > > Could you report a bug in gl_load() crashing blender?, I tried to redo > > > this but couldn't get blender to crash. > > > _______________________________________________ > > > Bf-committers mailing list > > > Bf-committers@blender.org > > > http://lists.blender.org/mailman/listinfo/bf-committers > > > > > _______________________________________________ > > Bf-committers mailing list > > Bf-committers@blender.org > > http://lists.blender.org/mailman/listinfo/bf-committers > > > _______________________________________________ > Bf-committers mailing list > Bf-committers@blender.org > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers