Bojan P.
11-26-2010, 12:53 AM
I'm having a problem with writing a shader. I first wrote this one:
#version 120
attribute vec3 position;
attribute vec3 normal;
uniform mat4 matWorldViewProjection;
void main()
{
gl_Position = matWorldViewProjection * vec4(position, 1.0);
}
And it worked. Than I wanted to start adding other stuff, but immediately ran into problem. This one doesn't work:
#version 120
attribute vec3 position;
attribute vec3 normal;
uniform mat4 matWorldViewProjection;
varying vec3 n;
void main()
{
gl_Position = matWorldViewProjection * vec4(position, 1.0);
n = normal;
}
It gives no error on compilation and linking, but nothing gets rendered.
I narrowed down the problem to vertex shader with my app and then switched to Render Monkey to work on this specific problem. It all started yesterday when I got Radeon 2600XT instead of Radeon X550 and installed new drivers - Catalyst 10.11. I had a working diffuse shader with texturing, but it stopped working with a new card/driver and that's why I started writing it from scratch - to see what's really happening there.
Fragment shader is trivial too:
#version 120
void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
Any ideas? I have run out of them.
#version 120
attribute vec3 position;
attribute vec3 normal;
uniform mat4 matWorldViewProjection;
void main()
{
gl_Position = matWorldViewProjection * vec4(position, 1.0);
}
And it worked. Than I wanted to start adding other stuff, but immediately ran into problem. This one doesn't work:
#version 120
attribute vec3 position;
attribute vec3 normal;
uniform mat4 matWorldViewProjection;
varying vec3 n;
void main()
{
gl_Position = matWorldViewProjection * vec4(position, 1.0);
n = normal;
}
It gives no error on compilation and linking, but nothing gets rendered.
I narrowed down the problem to vertex shader with my app and then switched to Render Monkey to work on this specific problem. It all started yesterday when I got Radeon 2600XT instead of Radeon X550 and installed new drivers - Catalyst 10.11. I had a working diffuse shader with texturing, but it stopped working with a new card/driver and that's why I started writing it from scratch - to see what's really happening there.
Fragment shader is trivial too:
#version 120
void main()
{
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}
Any ideas? I have run out of them.