Jump to content
  • Advertisement

Archived

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

Gammastrahler

How to draw three texures using mutlitexturing??

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

Hi, i have trouble blending three textures using mutlitexturing. My 3D card has only 2 texture units, and for two textures, it works (texture and lightmap). but i have trouble getting a third texture, i use a second rendering pass and change to the desired texture, but i still only get two textures! here´s my source for rendering:
  
glActiveTextureARB(GL_TEXTURE0_ARB); 
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, GetTextureID()); 
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, GetLightmapID()); 
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glBegin(GL_TRIANGLES);

   glMultiTexCoord2fARB(...);
   glMultiTexCoord2fARB(...);
   glVertex3f(...);

   2. vertex and 3. vertex

glEnd();
// second pass with third texture


glActiveTextureARB(GL_TEXTURE1_ARB); 
glBindTexture(GL_TEXTURE_2D, GetDetailMapID()); 		
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glBegin(GL_TRIANGLES);

   glMultiTexCoord2fARB(...);
   glMultiTexCoord2fARB(...);
   glVertex3f(...);

   2. vertex and 3. vertex

glEnd();

glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);

glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
  
can anyonle heelp me on this? thanks Gammastrahler

Share this post


Link to post
Share on other sites
Advertisement
I have tried with blend func, i have tested almost every blend func enum... It still does not work.... the third texture gets not drawn...

Share this post


Link to post
Share on other sites
I think you have to disable depth testing or something like that. That way the new polygons aren''t getting z-buffered away behind the already drawn stuff. I think.

--Buzzy
(formerly buzzy_b)

Share this post


Link to post
Share on other sites
If you're drawing the exact same triangle, use GL_LEQUAL (or GL_GEQUAL) as depth comparison function. And you also need that glBlendFunc.

And, hmm, you know that your code actually blends 4 textures ? I don't know if that is intended, you are doing: (pass1) tex0 * tex1, (pass2) tex0 * tex2. If you want tex0 * tex1 * tex2, then you need to disable the second texture unit before drawing the second pass, and load your third texture into unit 0. What blending equation are you after ?

[edited by - Yann L on June 9, 2002 7:15:40 PM]

Share this post


Link to post
Share on other sites

  • 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!