Jump to content
  • Advertisement
Sign in to follow this  
VerMan

glGetUniformLocation strange returning result

This topic is 2973 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, this is happening to me:
//fragment shader
uniform tex2D texture;
uniform tex2D texture2;
...


But when i try to get the uniform locations i get something like this:
t1 = glGetUniformLocation(program,"texture"); //returns 0
t2 = glGetUniformLocation(program,"texture2"); //returns -1!!


why the -1? if the uniform is there? if i change the names, sometimes i just get -1 always... wtf? is driving me crazy. Have you ever gone through this?

Share this post


Link to post
Share on other sites
Advertisement
Are you actually using texture2 for anything in your shader?

If it does not directly effect the output, it will be optimized out by GLSL compiler, and thus you cannot get the location anymore.

Share this post


Link to post
Share on other sites
uhmm ineresting... sometimes i se it, sometimes i don't since i'm doing some testing...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!