ShaderAttrib causing complete freeze with no error? (GLSL)

I am using the latest development build of Panda3d.

My program runs perfectly fine and will even allow me to execute setShader and bind ‘shader’ to the ShaderAttrib, but as soon as I attempt to use setShaderInput my game will not run and freezes completely and crashes, requiring a forced close.

        shader = Shader.load(Shader.SLGLSL, "glsl_shader.sha", "fragbasic.sha")
        
        
        self.altShaderAtt = ShaderAttrib.make()
        self.altShaderAtt = self.altShaderAtt.setShader(shader,1)
        self.altShaderAtt = self.altShaderAtt.setShaderInput("bANDw",2.0)
        self.altShaderAtt = self.altShaderAtt.setShaderInput("scale",1.0)

Please, if any one can help me or offer some input I would be very grateful. I have tried tweaking many times unsuccessfully.

Unfortunately, GLSL is broken in the latest version of Panda3D. Does the code work in 1.7.2?

Do other OpenGL programs that use GLSL work correctly?

Rdb, do you mean 1.8.0, or anything above 1.7.2? I’m using a buildbot build (1.9.0+cvs20120815~precise61) and GLSL works beautifully. I rewrote my whole lighting pipeline to GLSL without encountering any real problems aside of my own ignorance in GLSL :wink:.

claus, have you tried setting it through the more usual nodePath.setShader()? Also, a little piece of demo code would be useful.

@coppertop: As far as I know, all vertex attributes starting with gl_ including gl_Vertex, gl_Normal were broken from 1.8.0 up to a few days ago. If this is not the case for you, could you please e-mail one or two of your shaders to me to help me understand what is going on?

They might be broken (although I remember using them for a brief moment, actually), but from what I read, they’re deprecated, or even removed in the newest profiles, so that shouldn’t matter. There’s p3d_Vertex, which works just fine.

Also, I have this:

uniform mat4 gl_ModelViewMatrix;
uniform mat3 gl_NormalMatrix;

in my shaders, and it works fine as well. From what I see, that’s the only thing you need as far as gl_ prefix goes.

I’ve sent you two shaders along with a test program.

It’s not GLSL that is the problem, it’s the ShaderAttrib. I have my program successfully compiling and using GLSL, but when I try to use a ShaderAttrib in order to have separate effects for another camera(regardless of if I even use or apply the ShaderAttrib to any camera) my program freezes every time I attempt to use ‘setShaderInput’ on the ShaderAttrib after ‘setShader’.

In 1.7.2 I wasn’t even able to get my GLSL program to compile with out using ShaderAttrib.

I posted the only code that is causing an error, regardless of where, which Panda3d program or what GLSL shaders I use with it.