Advertisement Jump to content

Archived

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

cippyboy

3 texture units in 2

This topic is 5331 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 first saw this on Serious Sam(first or second encounter... don`t remember). And now it`s fairly used in games like Unreal and the like. Basicly we have a diffuse map, a detail map, and a lightmap. After seeing what the env_combine funcs can do, I came up with the idea for that 1 texture unit->Base Map*Detail Map(actually I use the GL_INTERPOLATE_ARB, but can`t figure out where to best put the Detail Map) 2 texture unit->LightMap This is what I use for that stuff ->
//

         glActiveTextureARB(GL_TEXTURE0_ARB);
//

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB);
    glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_INTERPOLATE_ARB);//

                                          // now setup Arg0

    glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_TEXTURE);
    glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_ALPHA);
                                          // now setup Arg1

	glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEXTURE);
    glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);

	glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE2_RGB_ARB,GL_PREVIOUS);
    glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND2_RGB_ARB,GL_SRC_COLOR);
//	

	glActiveTextureARB(GL_TEXTURE1_ARB);
//

	glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_ARB);
    glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_RGB_ARB,GL_MODULATE);
                                           // now setup Arg0

    glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_RGB_ARB,GL_PREVIOUS);
    glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_RGB_ARB,GL_SRC_COLOR);
                                          // now setup Arg1

	glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE1_RGB_ARB,GL_TEXTURE);
    glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND1_RGB_ARB,GL_SRC_COLOR);
My problem is-> If I`d normally use 3 texture units to make this stuff(and I wouldn`t bother anymore), everything would be just fine, but this way I won`t be able(or don`t know how to) scale the alpha map(which is the Detail Map), any help would be apreciated Edit:To clarify-> I mean I can`t use the
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(size,size,size);
glMatrixMode(GL_MODELVIEW);
to show detail upclose [edited by - cippyboy on June 1, 2004 12:33:48 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try this and see if it works:


glBindTexture(TextureID);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);

glBindTexture(DetailTextureID);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(DetailLevel, DetailLevel, 1);
glMatrixMode(GL_MODELVIEW);

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!