On Mon, Aug 15, 2011 at 7:05 PM, Ian Mallett <geometrian@...> wrote:
> 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:
> 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.
I've gone through your code and tried running it. I don't think I'm being
able to reproduce the problem you describe.
By default I get a red quad floating around (the one from the Display List)
and, upon pressing "D", a white quad appears. The red quad always stays red.
Maybe I'm not understanding the problem completely. Should any of the quads
change color when toggling the white one?
I'm running the source file without any changes, so (I think) I'm going
through steps 1,2,3,4 in order.
This is my current config:
'NVIDIA GeForce 9400M OpenGL Engine'