PDA

View Full Version : How to use Combined Texture?



LLM
06-02-2006, 12:38 AM
Usually, we draw a triangle with texture like this:

glBindTexture(GL_TEXTURE_2D,texturename);
glEnable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLES);
glTexCoord2f(0.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
...
glEnd();
And when we use Combined Texture which have two units:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texname0);
...
glActiveTexture(GL_TEXUTRE1);
glBindTexture(GL_TEXUTRE_2D, texname1);
...
The problem is how could we tell the triangle to use the combined texture?
glBindTexture()

CrazyButcher
06-02-2006, 04:44 AM
could you elobarate more on the question. cause apparently you already presented the code on "how to use more than one texture" ?

if you mean the way the textures are combined (color/alpha wise)
look into glTexEnv for some basic combiners, or the ARB_texture_env_combine extension for more complex combining

RigidBody
06-02-2006, 04:56 AM
don't forget that you have to call glEnable(GL_TEXTURE_2D) for each texture unit after choosing glActiveTexture().

LLM
06-03-2006, 07:09 AM
Use 3D texture to rendering a volume and use 1D texture to control the 3D texture's alpha value.
That is I want to do.

Usually, we use multitexture with glMultiTexCoord.But this time we can't. I have to creat only one TextureCoordinate array for 3D texture. I can't create texCoord for 1D Texture.Because it need more and more vertices.That is the problem.So Could I use Texture Combiner to deal with it?

k_szczech
06-03-2006, 05:39 PM
I can't create texCoord for 1D Texture.Because it need more and more vertices.
I don't quite understand it - do you want to use color fetched from 3D texture as coordinate for 1D texture? If yes, then you should use shader.
As long as you do not describe what functionality are you trying to implement we will probably not be able to help.

LLM
06-04-2006, 04:58 AM
I want to change the Volume Alpha value in real time mode.But create 3D texture need much more time.So I want to find a way to deal these.

First I want to use glColorTableEXT, but my graphic card do not support it.

then I want to use texture combiner to combine 3D texture and 1D texture, and change the 1D texture in real-time mode.But it does not seem correct So I find help here.

Shader can do these?