PDA

View Full Version : VertexArrays & Multitexturing...



TheBlob
06-01-2002, 08:25 AM
Hi!
Im having trouble to get Multitexturing working with my Vertex Array. Only my first Texture is displayed...
Heres my code:
Initializing:



glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


glClientActiveTextureARB(GL_TEXTURE0);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT, 0, textureData);

glClientActiveTextureARB(GL_TEXTURE1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT, 0, textureData2);

glColorPointer(3,GL_FLOAT, 0, colorData);
glNormalPointer(GL_FLOAT, 0, normalData);
glVertexPointer(3, GL_FLOAT, 0, pointData);


Rendering:



glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
texture_1.Specify(); //My class....the same as glBind....
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);


glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
texture_2.Specify();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );


glDrawElements(GL_TRIANGLE_STRIP,MAP_DIMENSION*2,G L_UNSIGNED_INT,indices);

glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);


Someone sees the mistake??
Thanks in advance.

[This message has been edited by TheBlob (edited 06-01-2002).]

Mazy
06-01-2002, 09:38 AM
Like having the DrawElements in the middle instead of after the second texture units settings?

Omaha
06-02-2002, 10:14 AM
Are you sure the texture is loaded properly? Remember, a typical symptom of an erroneous texture is a solid white image--which when combined with GL_MODULATE will make it seem as though no image has been applied at all.

TheBlob
06-02-2002, 11:03 AM
Ok, thanks so far...
Ive got it working now. The Problem was bad textures!