Skip to main content
GameDev.net gamedev.net
🔒 Locked

Environment Multi-texturing

Started by Qwanda Jul 21, 2002 at 12:31 PM 1 replies 300+ views
Original Post
Qwanda
Qwanda
Hello! I have recently got my ARB-Multitexturing to work with two textures. But how do i get one texture unit to be a sphere-map? And how do I control the blendfactor betwen the two textures? Thanx! Qwanda
silvermace
silvermace
you cant (not that i know off)
i find that an optimized manual multitextureing gives me more control over the end product, with only a tiny performace hit on slower machines.

what you''ll have to do is render the object using two passes instead of the single GL_ARB_multitexture.

How to Multipass
1. Render the First Pass
2. Disable Depthmask
3. Render the Second Pass
4. Restore the Depthmask

Example
this code can be optimized by sorting objects by state and
texture''s, remeber state changes are expensive, so code your
work to minimize the number state changes per frame.

void render(void){
GLuint _tBase,_tEnv;
glBindTexture(GL_TEXTURE_2D,_tBase);
// render object(s)
glDepthMask(GL_FALSE);
glBindTexture(GL_TEXTURE_2D,_tEnv);
// change state, ie. Enviro Map & blending
// render same objects again.
glDepthMask(GL_TRUE);
}


Enjor
laters
/silvermace
_the_phantom_
_the_phantom_
you can control the blending between two textures, look at Nvidia''s simple mutli-tex. example for one way of doing it.

It can also be used for other effects like specular highlights, check out Nutty''s page on effects using OGL extension ( http://opengl.nutty.org/extensions/index.html ) for details on that

Topic Locked

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

Sign in to reply to this topic.