Jump to content
  • Advertisement
Sign in to follow this  
Paul_H

multitexturing with vertex arrays

This topic is 4682 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im working on a morphing app, im using the ARBmultitexture extension for merging the textures, when I render the models using standard glBegin(GL_TRIANGLE_STRIP) approach it works fine, when I switch to using vertex arrays my textures fade to white. Heres a sample of my code:
	glClientActiveTextureARB( GL_TEXTURE0_ARB );
	glTexCoordPointer(2, GL_FLOAT, 0, texcoord1[0]);   
	glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
    
    glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
	
	glClientActiveTextureARB(GL_TEXTURE1_ARB );
	glTexCoordPointer(2, GL_FLOAT, 0, texcoord2[0]);   
	glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
    
    glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
    glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB );

    glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB );
    glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );

    glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE );
    glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR );

    glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB );
    glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR );
	

	glActiveTextureARB(GL_TEXTURE0_ARB);
	glEnable(GL_TEXTURE_2D);
	glBindTexture( GL_TEXTURE_2D, texture1 );

	glActiveTextureARB(GL_TEXTURE1_ARB);
	glEnable(GL_TEXTURE_2D);
	glBindTexture( GL_TEXTURE_2D, texture2 );

    glColor3f( blendvalue, blendvalue, blendvalue); //blend value [0..1]

	glVertexPointer(3, GL_FLOAT, 0, vertices);
	glDrawElements(GL_TRIANGLE_STRIP , numofindices , GL_UNSIGNED_SHORT , indices);


I also have vertex normals defined but whenever I enable lighting it seems to stop multitexturing from working. If anyone could offer any advice as to how I could stop the textures fading to white when blendvalue approaches 1, or how I could get lighting to work, I am aware I need a normal pointer, then I would be very grateful.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!