cooky451
09-18-2011, 05:28 PM
Edit: My fault, used getAttributeLocation instead of getUniformLocation.
Hi,
actually I'm very confused. I'm trying to make some simple 3D shader. So when my vertex-shader looks like this, the cube I'm rendering is perfectly visible:
#version 110
uniform mat4 camfrustum;
uniform mat4 camlocal;
uniform mat4 localpos;
attribute vec4 position;
mat4 nullmat()
{
return mat4(vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 24.0, 1.0));
}
void main()
{
gl_Position = camfrustum * nullmat() * camlocal * position;
}
But if I just change "nullmat()" to "localpos", the cube comes invisible, altough the matrix I'm passing with localpos remains exactly the same. I already tried "transpose" (on glUniformMatrix4fv), but it didn't work either. (The camera matrices work ok.)
Any idea's here? If here is no error and I need to post more code, please ask for explicit parts, because my code is devided through several classes.
Hi,
actually I'm very confused. I'm trying to make some simple 3D shader. So when my vertex-shader looks like this, the cube I'm rendering is perfectly visible:
#version 110
uniform mat4 camfrustum;
uniform mat4 camlocal;
uniform mat4 localpos;
attribute vec4 position;
mat4 nullmat()
{
return mat4(vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0, 0.0, 24.0, 1.0));
}
void main()
{
gl_Position = camfrustum * nullmat() * camlocal * position;
}
But if I just change "nullmat()" to "localpos", the cube comes invisible, altough the matrix I'm passing with localpos remains exactly the same. I already tried "transpose" (on glUniformMatrix4fv), but it didn't work either. (The camera matrices work ok.)
Any idea's here? If here is no error and I need to post more code, please ask for explicit parts, because my code is devided through several classes.