PyOpenGL glClearColor() trouble

Mike C. Fletcher mcfletch at rogers.com
Sun Apr 20 12:01:56 EDT 2003


TheDustbustr wrote:

>>use a real GUI library ;)
>>    
>>
>Which library do you suggest?
>  
>
I normally use wxPython, though PyGame is very popular among the gaming 
folks, and GLUT is popular for those who want to be able to follow 
common samples and documentation written for C.  (Honestly, though, I 
almost always use OpenGLContext when I'm creating OpenGL code, so it all 
works the same and I normally forget which of those three I'm using.)

BTW, I was mostly joking here.  I just don't like the Tk widget's 
approach (or Tkinter's look), (and I hate maintaining the widget,) but 
lots of people use it quite happily :) .  Tk does have a slightly more 
"bare-bones" widget in __init__.py, see the online pydocs for 
documentation on it.

>>I'm rather surprised if you care, it's very >seldom that such a call winds up
>>    
>>
>having a >significant overhead in an application
>I *believe* that this is also the source of another problem (my textures don't
>map to their poly's, my glColor3f() calls don't do anything), is this possible?
> I'm also using an event driven interface, could that be a problem?
>  
>
glClearColor() is an entirely seperate variable in the state machine 
from glColor3f().  It's really unlikely that they are doing anything to 
each other (if they really are it's likely a bug in your OpenGL 
implementation).

Textures not mapping to polygons is often a matter of:

    * forgetting to specify mapping coordinates
    * (comparatively rare) forgetting to specify texture mapping style
      (i.e. GL_REPEAT)
    * forgetting glBindTexture(GL_TEXTURE_2D, self.texture)
    * forgetting glEnable(GL_TEXTURE_2D)
    * not actually loading the image into the appropriate textureID

glColor3f similarly requires some setup to do "what you expect" in some 
cases, though it's normally less inclined to be messed up by aberrant state.

You can see a sample of how to setup a texture for rendering in 
OpenGLContext.texture and OpenGLContext.scenegraph.imagetexture.

Event driven interfaces are not a problem.  wxPython and GLUT are both 
event driven.  PyGame is too, it just has you write the event loop :) .

Good luck,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list