Simplest possible fragmen shader fails
OK, so its time to write the first most simple fragment shader ever. But
it doesn't work. Using a white background, I do as follow
void main()
{
gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);
}
I get a black teapot but was expecting a gray. Changing to
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
gives red teapot, and vec4(0.0, 1.0, 0.0, 1.0) and vec4(0.0, 0.0, 1.0,
1.0) gives green and blue teapot. But any RGB triplet with values < 1.0
are always truncated to 0.0. For example:
vec4(1.0, 0.5, 0.0, 1.0) -> pure red
vec4(0.0, 0.5, 0.5, 1.0) -> pure black
This is on an ATI card, Linux, Ubuntu 8.04. On NVidia it works and gives the correct colors.
Any idea what could be wrong here? I pretty new to GLSL so forgive me if this is a really stupid question.
Best regards,
Mads
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement