[PyOpenGL-Users] Possible PyOpenGL Material/Shader/Display List Bug
Brought to you by:
mcfletch
From: Ian M. <geo...@gm...> - 2011-08-15 22:05:22
|
Hi, There is an odd problem I've encountered. Also I describe on gamedev.net, here <http://www.gamedev.net/topic/608387-weird-shadermaterial-problem/>: 1. Bind a shader (compiles, links, etc. with no errors or warnings) 2. Draw a simple quad: glBegin(GL_QUADS) glVertex3f(0,0,0) glVertex3f(1,0,0) glVertex3f(1,0,1) glVertex3f(0,0,1) glEnd() 3. Call a display list. 4. Unbind the shader (back to fixed function) The display list contains code that alters material properties with glMaterialfv(...), as well as an object. The problem is that, though the object draws, the values of gl_FrontMaterial in the fragment program are incorrect, so it doesn't look as it should. Now, properties of the issue: -If I remove both steps 1. and 4., then the materials work correctly (though the rendering of the object isn't as nice). -If I instead remove step 2., then the shader works correctly (but then, of course, the simple quad isn't drawn). -If I add another step between 2. and 3., where I unbind and rebind the shader (i.e., steps are: 1, 2, 4,1, 3, 4), then the program works as expected (both the quad draws, and the materials work properly when the object is drawn--but then of course I'm binding and unbinding the shader when it really shouldn't be necessary). -Drawing the object without a display list alleviates the problem (but then it's slower). I've attached an example file (requires PyGame, PyOpenGL), tested with Python 2.6 on NVIDIA 8400M GS (tested against three different drivers) that demonstrates the problem. Click+drag to rotate, "D" to toggle drawing of other polygon. Thanks! Ian |