glActiveTextureARB
Hi...
I Currently have a problem with the glActiveTextureARB function. I have a VertexBuffer for my geometry and 2 Tex Coord buffers for Lightmap + Texture...
Iam absolutely sure that the tex coords in my buffers are right. My problem is that if i want to use both in different Textures (TEXTURE0 and TEXTURE1 which is a must for Lightmapped Textured), one of them doesnt work ( looks completely wrong )
So I tried to draw one by one
This does work:
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(CVector2), m_pTexCoords2); // m_pTexCoords2 is my Lightmap Texture Coordinate buffer
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_Lightmaps[pFace->iLightmapID]);
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glDrawArrays(...);
However this doesnt work
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(CVector2), m_pTexCoords2); // m_pTexCoords2 is my Lightmap Texture Coordinate buffer
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_Lightmaps[pFace->iLightmapID]);
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glDrawArrays(...);
I need to get it working for both Texture slots. Can anyone give me a hint whats wrong? Thanks
One is for arrays (eg glTexCoordPointer()), the other is for single instance parameters (eg glTexCoord2d()).
Crispy
Crispy
Oh.. and FYI ( I figured this out the hard way ), don''t enable arrayPointers that you don''t use. If you do, when you try to use glDrawArrays or simular functions, the program will crash.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement