   Loading Multiple Textures into GLSlang Shaders
  Hello to the forum, I have a question regarding loading multiple textures into GLslang shaders.  I've read similar recent threads but they didn't seem to solve my problem.when I execute the code below, I only seem to get access to the last texture loaded "indy.bmp" regardless of whether i set gl_FragColor to tex1 or tex2 [at //*************************]if I render using the normal OpenGL way the textures both render no probs, e.g:glBindTexture( GL_TEXTURE_2D, g_textureAID );// swap to g_textureBID to prove texture loaded okglInterleavedArrays( GL_T2F_C3F_V3F, 0, g_quadVertices );glDrawArrays( GL_QUADS, 0, 4 );heres the source, hope someone can help really pulling my hair out!thanks in advance!Dave Green :)// FRAG //uniform sampler2D testTextureA, testTextureB;void main(){vec4 tex1 = texture2D(testTextureA, gl_TexCoord[0].st);vec4 tex2 = texture2D(testTextureB, gl_TexCoord[0].st);gl_FragColor = tex2; //***************************}// VERT //varying vec3 lightDir,normal;void main( void ){gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;gl_TexCoord[0] = gl_MultiTexCoord0;   gl_FrontColor = gl_Color;}// OPENGL c code //GLuint    g_textureAID = 1;GLuint    g_textureBID = 2;GLintg_location_testTextureA;GLintg_location_testTextureB;AUX_RGBImageRec *pTextureImageA = auxDIBImageLoad( ".\\dave.bmp" );glGenTextures( 1, &g_textureAID );glBindTexture( GL_TEXTURE_2D, g_textureAID );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR );glTexImage2D( GL_TEXTURE_2D, 0, 3, pTextureImageA->sizeX, pTextureImageA->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pTextureImageA->data );AUX_RGBImageRec *pTextureImageB = auxDIBImageLoad( ".\\indy.bmp" );glGenTextures( 1, &g_textureBID );glBindTexture( GL_TEXTURE_2D, g_textureBID );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR );glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR );glTexImage2D( GL_TEXTURE_2D, 0, 3, pTextureImageB->sizeX, pTextureImageB->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pTextureImageB->data );g_location_testTextureA = glGetUniformLocationARB(g_programObj, "testTextureA");g_location_testTextureB = glGetUniformLocationARB(g_programObj, "testTextureB");if( g_location_testTextureA != -1 )  glUniform1iARB( g_location_testTextureA, 0 );if( g_location_testTextureB != -1 )  glUniform1iARB( g_location_testTextureB, 0 );glInterleavedArrays( GL_T2F_C3F_V3F, 0, g_quadVertices );glDrawArrays( GL_QUADS, 0, 4 );glUseProgramObjectARB( NULL );   
  You need to use multi texturing (and source tags!).Enable multi-texturing (if you are using GLSL then you must have extentions for multi-texture aswell), bind each texture to a different unit (a to 0, b to 1), then give the texture unit as the second parameter of glUniform.e.g.glActiveTexture(GL_TEXTURE0);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, g_textureAID);glActiveTexture(GL_TEXTURE1);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, g_textureBID);...if( g_location_testTextureA != -1 )    glUniform1iARB( g_location_testTextureA, 0 );if( g_location_testTextureB != -1 )    glUniform1iARB( g_location_testTextureB, 1 );;thanks for the quick response, sounds like the right area!I don't seem to have access to the function glActiveTexture() though, any ideas why that is?thanks!   ;  Its an extension.  And yeah, you bind the INDEX OF THE TEXTURE STAGE, not the textures namecheers-dan   ;  glActiveTexture and other multitexture functions are part of GL_ARB_multitexture extension (this got promoted to the core in GL 1.3, I think).To access this extension you can use extension loader like glew or glee (or you can write your own loader for specific extension, which will require much more work [smile]).To use multitexture with glsl you have to load your textures into specific texture unit. This is done by setting active unit with glActiveTexture(unit_number), enabling texture target for given unit (glEnable(texture_target)) and then binding your texture (glBindTexture(texture_target, texture_id)). To use texture from given unit in glsl you have to create sampler in your shader and bind it to given texture unit using glUniform1[fi]ARB (this function is in GL_ARB_shader_objects  extension).To disable specific texture unit when you don't need multitexture set active texture to given unit and call glDisable(texture_target). Default texture unit is 0. To determine number of texture units available in fixed function pipeline call glGetIntegerv(GL_MAX_TEXTURE_UNITS, &units) and units available for fragment processing glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &units).HTH   