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 > GLSL uniform no...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4825 of 4970
Post > Topic >>

GLSL uniform not accessable

by "Gernot Frisch" <me@[EMAIL PROTECTED] > Jul 7, 2008 at 06:46 PM

Hi, this code:
   glGetUniformLocationArb(shader_program, "red");
returns -1.

The "shader_program" is what I passed to glUseProgramObjectArb before.

I don't provide a vertex shader. My fragment shader code seems to be
loaded 
and working and is:

(BTW: I don't set the "image" in my main code anywhere, but I can access
the 
texture)

 # # #
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);
    }
}
 # # #



-- 
------------------------------------
Gernot Frisch
http://www.glbasic.com
 




 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 Mon Oct 13 8:47:36 CDT 2008.