Jump to content
  • Advertisement
Sign in to follow this  
Edge Damodred

Vertex texture appearing in fragment shader

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

When I use a vertex texture in a vertex shader, the fragment shader is using the vertex texture as the first texture used, regardless of the fact that I bound uniform sampler to a different texture object in the application. Another strange thing that is going on is that the vertex shader will only use the last bound texture object for the vertex shader, also regardless of the fact that I bound the uniform parameter to a different object in the application.

Share this post


Link to post
Share on other sites
Advertisement
If you bind a texture to unit X, then in vertex and fragment shader you can sample the same texture. You should bind vertex texture to unit 0 and fragment texture to unit 1 and that way it will work.

Share this post


Link to post
Share on other sites
Thanks for the hint. For clarification I'm using Cg instead of GLSL and Cg apparently ignores your explicit OpenGL's texture commands, even if you tell it not to. The cgGLEnableTextureParameter() command ignored the glActiveTexture() command even though I told the cg runtime not to manage textures with cgGLSetManageTextureParameters(), although the documentation says it doesn't do this by default.

I just changed each of the uniform parameter's semantics to the correct texture unit and then made the appropriate glActiveTexture() calls and things worked beautifully.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!