Skip to main content
gamedev.net
🔒 Locked

Getting Multitexturing to work

Started by Nuclear 0 replies 450+ views
Original Post
Nuclear
Nuclear
Hi people... I am porting these days my 3D engine from Direct3D8 to OpenGL and I''m having some dificulties with multitexturing... As a test I try to render a quad with two textures "added" together. But it seems that only the second gets draw. the code is as follows: glClientActiveTextureARB(GL_TEXTURE0_ARB); glBindTexture(GL_TEXTURE_2D, texture1); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); glClientActiveTextureARB(GL_TEXTURE1_ARB); glBindTexture(GL_TEXTURE_2D, texture2); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB); And then i render with glDrawElements() ... what''s wrong? btw the material is set to white, so it''s not that the first texture gets modulated with black or something, after all the output seems like the first texture stage feeds all white pixels to the second stage (as if the texture did not exist and what i see is the material)... also if i add the two lines glClientActiveTextureARB(GL_TEXTURE2_ARB); glDisable(GL_TEXTURE_2D); which as i understand disables the 3rd texture unit, no texture at all gets rendered (not even the second). any ideas? am i doing something terribly wrong? thanx in advance ... -- Nuclear / the Lab --
Buzzy
Buzzy
I think you have to do glActiveTextureARB() in addition to the client one. But don''t quote me on that, I''m really tired right now...

--Buzzy
(formerly buzzy_b)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.