Sign in to follow this  

glslang multitexturing

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

hi. how do I specify which texture unit ( TEXTURE0_ARB, TEXTURE1_ARB, ... ) to use during glsl process? if i simply define a texture sampler by "uniform sampler2D s;" the first texture unit is used. how can i reference to another texture unit? thanks in advance

Share this post


Link to post
Share on other sites
Hello!

in the fragment shader you have to define sampler2D-s like this:
uniform sampler2D basetexture;
uniform sampler2D bumptexture;

From the opengl code:
gl.glUseProgramObjectARB( normalShaderObj );
int baseTexture = gl.glGetUniformLocationARB( normalShaderObj, "basetexture".getBytes() );
gl.glUniform1iARB( baseTexture, 0 ); // 0 is GL.GL_TEXTURE0_ARB
int bumpTexture = gl.glGetUniformLocationARB( normalShaderObj, "bumptexture".getBytes() );
gl.glUniform1iARB( bumpTexture, 1 ); // 1 is GL.GL_TEXTURE1_ARB

Hopefully, this might help.

Share this post


Link to post
Share on other sites

This topic is 4819 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this