PyOpenGL glClearColor() trouble

Mike C. Fletcher mcfletch at rogers.com
Sat Apr 19 22:43:08 EDT 2003


This is a "feature" of the Tk widget defined in OpenGL.TK.__init__.py .  
Basically, the tkinter widget is giving you a "simplified" environment 
for your OpenGL code, so it does silly things like setting a background 
color based on attributes of the Tk widget.  These attributes are:

        self.r_back = 1.
        self.g_back = 0.
        self.b_back = 1.

You can set those directly, call self.ogl.set_background( r,g,b ), or 
override the ogl widget's tkRedraw method at your preference (or use a 
real GUI library ;) ).  However, save for the last option, you won't 
actually avoid the glClearColor call.  (I'm rather surprised if you 
care, it's very seldom that such a call winds up having a significant 
overhead in an application).

Enjoy yourself,
Mike

TheDustbustr wrote:

>from OpenGL.GL import *
>import OpenGL.Tk as Tk
>  
>
...

>The way the script is set up right now (second glClearColor commented), glClear
>clears the screen to the default ClearColor (1,0,1,0 aka pink).  I can only
>make the ClearColor black (0,0,0,0) when I call glClearColor in the ogl.redraw
>function... This is inconvienent and I shouldn't need to be called every frame.
>  
>
... 
_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list