Re: Texture JOGL -> GLSL
Posted by
AlexRNL on
May 16, 2011; 1:07pm
URL: https://forum.jogamp.org/Texture-JOGL-GLSL-tp2947210p2947796.html
Demoscene Passivist wrote
For using textures with shaders u have to use the "active texture unit number" instead of the generated "texture id" a sampler uniform value. U are using the "texture id" from getTextureObject() instead. Thats why ur code works unreliable. Try doing stg like this:
inGL.glActiveTexture(inTextureUnit);
inTexture.enable();
inTexture.bind();
ShaderUtils.setUniform1i(inGL,inProgramID,inSamplerUniformName,inTextureUnitNumber);
inTexture.disable();
Thanks for your answer, it seems it will to solve my problem(s) !
However, I can't find the class ShaderUtils. I have found another example for using this class
here. I have search in JOGL 1.1 & JOGL 2.0 but I only found
this class (without the 's') and there is no function such as 'setUniform1i).