Sign in to follow this  

Multitexturing

This topic is 4840 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

Ive read a few tutorials bout multitexturing but they all used 2 textures. So i tried to just add another 1, but it doesnt work. I just see the first and third texture. And if i disable the first i only see the third.. Is there anything wrong with this code? (Dont think so, cus i copied the main part from a tutorial :) glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB"); glMultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB"); CreateTexture(g_Texture, "rood.bmp", 0); CreateTexture(g_Texture, "blauw.bmp", 1); CreateTexture(g_Texture, "geel.bmp", 2); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, g_Texture[0]); glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, g_Texture[1]); glActiveTextureARB(GL_TEXTURE2_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, g_Texture[2]); glPushMatrix(); glTranslatef(-2, 0, 0); glBegin(GL_QUADS); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 1.0f); glVertex3f(-1, 1, 0); glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f); glVertex3f(-1, -1, 0); (and a bit more vertices to make a quare :) Plz help XishtarX

Share this post


Link to post
Share on other sites
There's nothing you can do about it,other than buy a new card.You can however use more than 2 textures to render an object,you just need to perform multiple rendering passes and blend the outcome.For example,this modulates 4 textures:


glDepthFunc(GL_LEQUAL);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, g_Texture[1]);

glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, g_Texture[2]);
RenderObject();

glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, g_Texture[3]);

glActiveTextureARB(GL_TEXTURE2_ARB);
glBindTexture(GL_TEXTURE_2D, g_Texture[4]);

glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR,GL_ZERO);
RenderObject();
glDisable(GL_BLEND);



Share this post


Link to post
Share on other sites

This topic is 4840 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this