PDA

View Full Version : Anyone know any tutorials on multitexturing and blending?



manastone
08-19-2006, 11:15 PM
Does any know of any links to documentation for multitexturing features of openGL? I’m looking for a way to blend two textures so that it is 75% of one texture and 25% of the other. Can anyone provide me with any tutorials?

08-20-2006, 02:17 AM
buy a recent version of the redbook and learn it all at once.

hth

08-20-2006, 02:28 AM
or read the opengl specifiaction for free.

hth

Zengar
08-20-2006, 05:39 AM
I would advice you to learn shaders (if you have the hardware, of course). Othervise look into ARB combiners. Nehe tutorials should cover it, I think.

V-man
08-23-2006, 09:45 AM
I don't know of any tutorials but I'm sure Nehe has something. To do that kind of blending, it's called interpolation.


glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);

float mycolor[]={0.75, 0.75, 0.75, 0.75};
glTexEnfv(GL_TEXTURE_ENV, ..., mycolor);

manastone
08-23-2006, 09:48 AM
Usually the demos that I download that use pixel shaders are extremely slow so I don't think I have hardware support for that. Even if I did though, I still wouldn’t want to use them because there would be a large number people that wouldn’t be able to use my program and I’d want to market it to as many people as possible.

I’ve been going over the specs if it mentions anything about what I’m trying to do then it went right over my head. Could somebody at least tell me if it is possible to do without using shaders?

manastone
08-23-2006, 10:25 AM
Thanks V-man, I just ranked you up on gamedev.