View Full Version : How to load multiple Texture

07-26-2003, 03:32 PM
How to load Multiple Textures?
Some of them are just lookup table I will use int teh fragment program.

07-26-2003, 08:08 PM
Just use glTexImage2D with the current multitexture target set using the glActiveTexture call. Binding subsequent to your load should also work on the active texture.

07-26-2003, 09:24 PM
in fact
what I am trying to do is use one texture as an lookup table.

so 1st.
color1 = Texture(r,s, t)
then I use the alpha value of color1 as the index of to find color on 2nd one dimension textures.

I use cg..
can I direct use color as the index to lookup at the another map?

07-27-2003, 09:53 AM
Yes, you can. I have no idea how to do this in Cg, but I use nvparse for texture shaders. But since cg is only a layer on top of OpenGL, there is also a way to do this in Cg. I use the "dependent_ar" texture shader to use the alpha value of a texture unit to look up a value from another texture. I configured texture units as follow:

tex0: a decal texture (texture_2d(); )
tex1: lookup texture (dependent_ar(tex0); )

Texture unit 1 uses the alpha and red channel of texture unit 0 as (s,t)-coordinates to look up some value. There are more dependent texture shaders for 1D and 3D textures. Check out the NVidia OpenGL spec.

[This message has been edited by mako (edited 07-27-2003).]