PDA

View Full Version : disable multitexture/uvs when done?



supagu
03-31-2004, 11:04 PM
okay i am using vbo's with 2 sets of uv's and 2 textures to render my scene with a lightmap.

this is currently how i disable them:

glClientActiveTexture( GL_TEXTURE0_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );


glClientActiveTexture( GL_TEXTURE1_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );

now, this doesnt work properly, as my other models that dont use vbos and multitexturing such as my font system and skybox are rendered really dark, and flicker like some multitexturing is still happening?

ideas? thanks...

Bob
03-31-2004, 11:47 PM
Do you disable texturing for all units aswell?

edit: Should read the question better next time. Texture bindings are not a clinet state, it's a server state, so you need to change texture unit with glActiveTexture. And use glDisable instead of binding ID 0.

zeckensack
04-01-2004, 02:31 AM
Yup. Disable texcoords and texturing.

glClientActiveTexture( GL_TEXTURE0_ARB );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glActiveTexture(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D); //or _1D, _3D, _RECTANGLE_EXT, whatever

glClientActiveTexture( GL_TEXTURE1_ARB );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glActiveTexture(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);

//optional paranoia
glClientActiveTexture(GL_TEXTURE0_ARB);
glActiveTexture(GL_TEXTURE0_ARB);

jwatte
04-01-2004, 02:18 PM
Do you set the active texture back to TEXTURE0 before setting up other texturing?

Also, you don't need to separately BindBuffer(). The bound buffer is only actually inspected by the GL when you call VertexPointer, TexCoordPointer, etc.