Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > Re: GLSL unifor...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 4825 of 5017
Post > Topic >>

Re: GLSL uniform not accessable

by "Gernot Frisch" <me@[EMAIL PROTECTED] > Jul 8, 2008 at 11:56 AM

> # # #
> uniform sampler2D image;
> uniform float red, green, blue;
>
> void main()
> {
> vec4 texel = texture2D(image, gl_TexCoord[0].xy).rgba;
>
>    if(texel.a > 0.001)
>    {
>      if(abs(texel.g - texel.r) < 0.0001) // black -> recolor
>      {
>        gl_FragColor = vec4(red, green, blue, texel.a);
>      }
>      else // blue eyes
>      {
>        gl_FragColor = texel;
>      }
>    }
>    else // transparent
>    {
>      gl_FragColor = vec4(0,0,0.0, 0.0);
>    }
> }

Oh dear! The compiler's optimized my uniform variable out. I put a 
glFragColor=vec4(1,0,0,1) at the end, just to see if the shader gets
loaded. 
Doh!
 




 3 Posts in Topic:
GLSL uniform not accessable
"Gernot Frisch"  2008-07-07 18:46:35 
Re: GLSL uniform not accessable
"Gernot Frisch"  2008-07-08 10:35:19 
Re: GLSL uniform not accessable
"Gernot Frisch"  2008-07-08 11:56:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 6:17:09 CST 2008.