Jump to content
  • Advertisement
Sign in to follow this  
zootroy

Disabe Textures in GLSL

This topic is 4495 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

I am writing a shader to do per fragment lighting. Everything is working well except that I can't turn textures off. App Code: glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture.TexName()); DrawTorus(...); glDisable(GL_TEXTURE_2D); DrawTorus(...); When rendering with the fixed pipe, I get a textured torus and a torus with the previously defined material. in my shader, I get two textured tori. I tried adding the line glBindTexture(GL_TEXTURE_2D, 0); before my second torus call, but my shader spit out a black torus. here is the code in my fragment shader, ala Rost: // calculate diffuse with multiple lights diffuse *= texture2D(Tex, gl_TexCoord[0].st); I would like to query the current state from my shader to determine if 2D textures are enabled. Any ideas? TIA J

Share this post


Link to post
Share on other sites
Advertisement
You should be able to query the state of the FF setup in a shader, but I forget the exact syntax (and I havn't got my orange book on me). However you might want to look at this.

Share this post


Link to post
Share on other sites
glEnable(GL_TEXTURE_2D); + disable are ignored with glsl, ie u cant enable or disable texture units (if u dont wanna use one then dont access it)

Quote:
I would like to query the current state from my shader to determine if 2D textures are enabled.

u will have to pass this info to the shader yourself as a uniform

Share this post


Link to post
Share on other sites
I too faced with the same problem of accessing texture state in the shader. For the time being i'm using uniforms for that purpose.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!