Original Post
hrmm i have just got multitexture working, but it wont let me change the textures?
(is there some option to vary how they are combined? )
but the problem is, say i have a road texture and grass texture, the whole map ends up being rendered with the road texture for seom reason... even the skybox which doesnt use VBOs?!
glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable(GL_TEXTURE_2D);
material->SetMaterial(0); //just binds texture
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_INDEX_ARRAY );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboPositions );
glVertexPointer( 3, GL_FLOAT, sizeof(Vector3), 0 );
if( uvCoords != 0 )
{
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
//if( gluxIsAvailable("GL_ARB_multitexture") == GLUX_AVAILABLE )
// glClientActiveTexture( GL_TEXTURE0_ARB );
glClientActiveTexture( GL_TEXTURE0_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboTexCoords );
glTexCoordPointer( 2, GL_FLOAT, sizeof(UVCoord), 0 );
}
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, vboIndices );
glIndexPointer( GL_UNSIGNED_INT, sizeof(unsigned int), 0 );
if( uvCoords2 != 0 && material->texture2 != 0 )
{
//set second channel
glActiveTextureARB( GL_TEXTURE1_ARB );
glEnable(GL_TEXTURE_2D);
material->texture2->SetTexture(1);
glClientActiveTexture( GL_TEXTURE1_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboTexCoords2 );
glTexCoordPointer( 2, GL_FLOAT, sizeof(UVCoord), 0 );
}
glDrawElements( GL_TRIANGLES, noPolys*3, GL_UNSIGNED_INT, 0);
polys += noPolys;
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
is there something wrong some where?
the first texture should be changing, while the second texture is my lightmap, it blends the textures great