• Advertisement

Archived

This topic is now archived and is closed to further replies.

Multitexturing & Blending

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

I would want to know how to simulate glColor3ub(255,255,255); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_DEPTH_TEST); for (int i=0; i<4; i++) { glBindTexture (GL_TEXTURE_2D, TextNames); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1, -1, -1.0f); glTexCoord2f(0.0f, 1); glVertex3f(-1, 1, -1.0f); glTexCoord2f(1, 1); glVertex3f(1, 1, -1.0f); glTexCoord2f(1, 0.0f); glVertex3f(1, -1, -1.0f); glEnd(); } using multitexturing. I have tried for several ways. None of them work. The following doesn''t give me the same image. glColor3ub(255,255,255); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_DEPTH_TEST); for (unsigned int u=0; u<4; u++) { glActiveTextureARB(GL_TEXTURE0_ARB+u); glBindTexture(GL_TEXTURE_2D, TextNames[i+u]); Apply(); } glBegin(GL_QUADS); for (u=0; u<4; u++) glMultiTexCoord2fARB(GL_TEXTURE0_ARB+u, 0, 0); glVertex3f(-1, -1, -1.0f); for (u=0; u<4; u++) glMultiTexCoord2fARB(GL_TEXTURE0_ARB+u, 0, 1); glVertex3f(-1, 1, -1.0f); for (u=0; u<4; u++) glMultiTexCoord2fARB(GL_TEXTURE0_ARB+u, 1, 1); glVertex3f(1, 1, -1.0f); for (u=0; u<4; u++) glMultiTexCoord2fARB(GL_TEXTURE0_ARB+u, 1, 0); glVertex3f(1, -1, -1.0f); glEnd(); } where Apply() is just Apply() { glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT); glTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB_EXT,GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT,GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE2_RGB_EXT, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND2_RGB_EXT,GL_ONE_MINUS_SRC_ALPHA); glTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_ALPHA_EXT, GL_INTERPOLATE_EXT); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_EXT, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_EXT,GL_SRC_ALPHA); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND1_ALPHA_EXT,GL_SRC_ALPHA); glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE2_ALPHA_EXT, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND2_ALPHA_EXT,GL_ONE_MINUS_SRC_ALPHA); } I don''t know what I am doing wrong, but the resulting image is not exactly the same. Thanks a lot for any help.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement