Sign in to follow this  
relsoft

MultiTexture woes....

Recommended Posts

relsoft    255
Sorry for asking this "probably-asked-1000-times" question but I'm a little bit rusty on coding ( stopped coding for a while and just started coding again) but why doesn't this work? glEnable (GL_BLEND) glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) '0 glActiveTextureARB( GL_TEXTURE0 ) glBindTexture( GL_TEXTURE_2D, texture ) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) GL_REPLACE) '1 glActiveTextureARB( GL_TEXTURE1 ) glBindTexture( GL_TEXTURE_2D, texture + 1 ) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE) glBindTexture( GL_TEXTURE_2D, texture + 1) glEnable( GL_TEXTURE_2D ) glBegin( GL_QUADS ) glMultiTexCoord2fARB( GL_TEXTURE0, 0.0f, 0.0f ) glMultiTexCoord2fARB( GL_TEXTURE1, 0.0f, 0.0f ) glVertex3f( -1.0f, -1.0f, 0.0f ) glMultiTexCoord2fARB( GL_TEXTURE0, 0.0f, 1.0f ) glMultiTexCoord2fARB( GL_TEXTURE1, 0.0f, 1.0f ) glVertex3f( -1.0f, 1.0f, 0.0f ) glMultiTexCoord2fARB( GL_TEXTURE0, 1.0f, 1.0f ) glMultiTexCoord2fARB( GL_TEXTURE1, 1.0f, 1.0f ) glVertex3f( 1.0f, 1.0f, 0.0f ) glMultiTexCoord2fARB( GL_TEXTURE0, 1.0f, 0.0f ) glMultiTexCoord2fARB( GL_TEXTURE1, 1.0f, 0.0f ) glVertex3f( 1.0f, -1.0f, 0.0f ) glEnd glPopMatrix I'm trying to do transparencies using multitexturing but somehow it doesn't seem to work? I have made something like this using a two-pass method but it does not use multi-texturing. Just standard GL blending funks. anyway's here's the demo of what I would like to acheive using multi-texturing. http://rel.betterwebber.com/junk.php?id=48 Thanks in advance. :*)

Share this post


Link to post
Share on other sites
Kalidor    1087
Quote:
Original post by relsoft
glEnable (GL_BLEND)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Blending (glBlendFunc) is for blending what you're currently rendering with what is currently in the framebuffer, not for blending in multitexturing, so unless that's what you want to do that should be disabled.
Quote:
Original post by relsoft
'0
glActiveTextureARB( GL_TEXTURE0 )
glBindTexture( GL_TEXTURE_2D, texture )
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
GL_REPLACE)

'1
glActiveTextureARB( GL_TEXTURE1 )
glBindTexture( GL_TEXTURE_2D, texture + 1 )
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE)
What your telling OpenGL to do here is for the first step in the multitexturing stage to output the primary color multiplied by the first texture's color. Then in the next step you're telling it to just output the second texture's color and ignore whatever was output from the previous step. I'm assuming that's not what you want to do (I can't look at the demo now so I don't know).

You only show that you're enabling texturing on texture unit 1. If you aren't enabling it on texture unit 0 as well you need to.

Also, you show a glPopMatrix call but no glPushMatrix, so if it's really like that in your code you will want to fix that first.

Share this post


Link to post
Share on other sites

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