03-15-2006, 03:36 AM
I need to apply a spherical mapped environment texture to an object followed by another texture that uses alpha blended texture. The result is an a shiny object apart from areas that were excluded by the second texture.
Now the problem is down to the fact that I can't afford the performance hit caused by the multipass rendering and wondered how / whether I could use achieve the same result in a singlepass ?
I need to avoid many of the more advanced features now supported by cards - let's say that it's got to work on something like an NVidia Geforce 2.
03-15-2006, 05:40 AM
Why not multitexture instead of multipass ?
search "Official Multitexture Extension" in following page :
03-15-2006, 07:01 AM
Thanks for the reply ... I think that I am on my way now ... lots to learn again, as I've no idea what half of this does yet ! Some good pointers to some docs would be good.
OK ... I've found some code that I've modified and it works ... but ... issues of card compatibility are of concern ... for example is GL_COMBINE4_NV which obviously originates from NVidia - is it available on most cards - ATI ?
// Already tested for extensions ...
LoadBitmapFile('LogoMetal.bmp', fTextureName1, GL_FALSE);
// The 'true' flag creates a texture with an alpha channel.
LoadBitmapFile('Tile.bmp', fTextureName2, GL_TRUE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_ONE_MINUS_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE3_RGB_EXT, GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND3_RGB_EXT, GL_SRC_ALPHA);
// Draw routine ...
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
03-15-2006, 07:36 AM
Yes it is NV only, i think the following extension looks more suitable :
and is widely supported from geforce2/radeon7000 hardware :
03-15-2006, 11:26 AM
Many thanks for your help ...
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.