Re: Texture JOGL -> GLSL
Posted by
AlexRNL on
May 17, 2011; 7:47am
URL: https://forum.jogamp.org/Texture-JOGL-GLSL-tp2947210p2951536.html
Demoscene Passivist wrote
Modern GPUs can only handle a limited number of simultaneous textures. This limitation is abstracted as "texture units" in OpenGL. The number of textures to be used (e.g. by a shader) is queriable from the constant GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (usually 8+ on a modern GPU).
GL_TEXTURE0 is such a "texture unit" from wich u have usually 7 more. The way u use one of these units is to "active" it with "glActiveTexture(inTextureUnitNumber)". After activation u can bind a texture to it with "glBindTexture(inTextureID)". After u have activated the texture unit and bound a texture to it u can then inform ur shader to use this texture unit as sampler uniform.
So the shader has no idea what texture it is actually using, it is simply using the bound texture unit as source for the texture data.
For an example using 4 texture units bound to 4 different textures take a look at my
GL3_ParallaxOcclusionMapping.java
OK, I understand how it works now!
Thanks again this conversation has been very helpful!