Hi,
thank you. I am going to try all of that. I think the trick of using
> 0.3 for your color and GL_MODULATE and GL_ADD as the tex modes.
should work very well. Anyway I would like to understand more about
GL_COMBINE. Still now I don't understand well how the layers (textures) work
in the sequence. For example, when I have to apply different combinations,
should I set GL_TEXTURE_ENV_MODE, GL_COMBINE_RGB, GL_SOURCE0_RGB,
GL_OPERAND0_RGB all the times?
And when should I use GL_SOURCE2_RGB ? Only if I have to combine 3 textures?
Just to know: if I have 3 textures can I combine them in 2 different steps
and don't use GL_SOURCE2_RGB but use only GL_SOURCE0_RGB and GL_SOURCE1_RGB?
Best Regards
--
Lorenzo
email: email@hidden
> From: bsupnik <email@hidden>
> Date: Wed, 03 Nov 2004 13:50:35 -0500
> To: Lorenzo <email@hidden>, email@hidden
> Subject: Re: GL_COMBINE 2 Textures
>
> Hi Lorenzo,
>
> I'm not sure that these are your problems, but here are a few issues to
> look at:
>
> - The combine extension doesn't guarantee that you can use any texture
> as any source to a combine op.[ You do
>
>> glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
>
> I don't know about the crossbar extension but without it this is illegal
> - use GL_PREVIOUS as your source to get the last texture.
>
> - It's been my experience that you need to specify every aspect of the
> combine op...this may just be me being paranoid, but I would consider
> putting _something_ in the alpha channel for this.
>
> - I don't think 'combine' will mix 100% of A + 30% of B - it will give
> you 70% of A and 30% of B. To get that, bind your constant (0.3) to
> input 2 and your two textures (GL_PREVIOUS and GL_TEXTURE) to input 0 and 1.
>
> - A way to get 30% + 100% with two tex units (which you might as well
> do anyway since you have to use two tex units to do do two textures) is
> to put the 30% texture in the first unit and modulate it with a constant
> of 0.3. Then put the second tex in unit one and use add.
>
> - You can accomplish the above without using GL_COMBINE at all, as
> long as it's all you want, just use 0.3 for your color, GL_MODULATE and
> GL_ADD as the tex modes.
>
> This all gets a lot trickier if you want (100% of A + 30% of B) *
> local_lighting...
>
> *Cheers*
> Ben
>
>
> Lorenzo wrote:
>> Hi,
>> I am trying to mix 2 textures. 100% of the first texture + 30% of the second
>> texture. I wrote the following code, but I get bad results. Do you know
>> where is my mistake?
>>
>> glActiveTexture(GL_TEXTURE0);
>> glEnable(GL_TEXTURE_RECTANGLE_EXT);
>> glBindTexture(GL_TEXTURE_RECTANGLE_EXT, textures_rect[0]);
>>
>> glActiveTexture(GL_TEXTURE1);
>> glDisable(GL_TEXTURE_RECTANGLE_EXT);
>> glEnable(GL_TEXTURE_2D);
>> glBindTexture(GL_TEXTURE_2D, textures_2D[0]);
>>
>> glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
>> glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
>> glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
>> glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
>>
>> // Point A
>> GLfloat blendColor[4] = {1.0, 1.0, 1.0, 0.3};
>> glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, blendColor);
>> glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT);
>> glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_ALPHA);
>>
>> // Point B
>> glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE1);
>> glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
>>
>>
>> I even inverted the point A with the point B but I get bad results again.
>>
>>
>> Best Regards
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden
This email sent to email@hidden