Problem with texture binding while drawing multiple objects
Dear all, I'm a beginer to OpenGL, this problem confused me for a whole afternoon.
Problem is that, all objects with various textures are drawn with only one texture, even if I call glBindTexture to bind different textures to different objects each frame, it seems like only one glBindTexture call works. This is code of unwrapped draw call:
// This is the diffuse texture
// m_pMat->GetTexDif() return different texture names with different objects
// This is the normal texture
glDrawElements(GL_TRIANGLES, m_uFaceNum * 3, GL_UNSIGNED_INT, (void*)0);
// query current binding texture, result is different among different draw calls
// but the shader still get same one, so strange.
printf("current binding texture: %d\n", currentTex);
The shader does get both diffuse texture and normal texture, however, all objects get same ones.
Can anyone find how does this error happen? Appreciate.
By the way, I'm using Win7 64bit, Nvidia Geforce GTX560, OpenGL/GLSL 4.3 with newest driver, GLEW 1.9.0 and GLFW 2.7.6