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);
How to draw three texures using mutlitexturing??
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:
can anyonle heelp me on this?
thanks
Gammastrahler
For multipass rendering use glBlendFunc.
Death of one is a tragedy, death of a million is just a statistic.
Death of one is a tragedy, death of a million is just a statistic.
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...
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)
--Buzzy
(formerly buzzy_b)
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]
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]
this werks, i had to do it for a game engine i was coding
glDepthMask(GL_FALSE);
second pass here
glDepthMask(GL_TRUE);
glDepthMask(GL_FALSE);
second pass here
glDepthMask(GL_TRUE);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement