[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: [pyopengl] glActiveTexture(GL_TEXTURE1) cause failure in my code, can't get the reason why



On Feb 5, 7:39 pm, Ian Mallett <geometr...@xxxxxxxxx> wrote:
> Hi,
>
> Have a look at the output; the minus one indicates an invalid index, invalid
> because the variable it points to does not exist in the shader.  Although it
> doesn't on my machine, perhaps trying to pass the uniform to it causes some
> error.
>
> The reason "Texture_1" doesn't exist in the shader is that GLSL optimized it
> out, because it wasn't used.  If you uncomment the mix command in the
> fragment shader, you'll see that the index goes away (and for me a nice
> multitextured teapot starts rotating).
Hi Ian.
Yes i got this point as you explained me in the previous topic about
compiler optimization for unused variables.
The reason i have commented mix, i change manually in the shader
texel0 and texel1 to see what is going on here.


> Also note: glGetUniformLocation doesn't have very well-defined operation
> unless the shader is bound.  Perhaps when you print the locations on line
> 157, you're inadvertently causing an error later.
I have commented the prints, but this is does not resolve the problem,
problem is the same.
I sure that is in something with my GLUT implementation or setup,
because if commented only 3 strings:
#from OpenGL.GLUT import *
#glutInit(sys.argv)
#glutSolidTeapot(1.0)
My program runs well without a fault described below. Then i just
added manually quad vertexes and put textures in there by GLSL,
everything works good now for me.

Cheers, Alex