Re: multitexturing and combiners problems
- From: "Dave Eberly" <dNOSPAMeberly@xxxxxxxxxxxxxxx>
- Date: Fri, 14 Apr 2006 21:54:51 GMT
"fungus" <umailMY@xxxxxxxxxxxxxxx> wrote in message
news:qdT%f.8685$un5.4830@xxxxxxxxxxxxxxx
Maybe it's just me, be patient.... :-)
First, let's put this back in the perspective of what the
OP wanted. The OP made it clear he is inexperienced
with multitexturing and register combiners (and by
implication, probably also with shader programming).
The OP also wrote
% I just need to apply two textures to a lit polygon,
% and the second texture has an alpha channel that
% has to be taken into account.
My interpretation of all this.
(1) He does not understand the OpenGL syntax for
setting up the register combiners.
(2) The polygon is lit first and he wants to apply textures
to it.
My posted code is a working program to show him the
syntax, addressing item (1). That code uses blending
equations to use lighting first, addressing item (2).
The "requirement" of lighting last was imposed by you,
independent of anything I saw the OP post here. Perhaps
he wants to reconsider the semantics (i.e. how to blend
things and in what order), but that is actually irrelevant
to his original post.
When the incoming texture color on unit 1 is 0xffffffff
then a[1]=255 and RGB[1] is "white", yes?
So result1 is going to be "white" regardless of lighting.
The OP mentions his texture1 has an alpha channel, and he
expressed an interest in blending the texture1 with the
contributions from lighting and texture0. I presume that to
do so, he is *not* going to set all the alpha values of
texture1 to 1, thereby producing an opaque image that
hides the lighting and texture0.
Based on the OP's other questions, he is not certain about
how blending works anyway, especially not understanding
that multitexturing (register combiners) do not need
glEnable(GL_BLENDING). That also begs the question of
whether or not he understands what all the source and
destination blending modes are. Since he never mentioned
*how* he wanted to blend lighting and textures, I took the
liberty of writing a sample program that uses the standard
alpha blending modes. It is up to him to decide if those are
acceptible or if some other modes are more suitable for what
he wants.
--
Dave Eberly
http://www.geometrictools.com
.
- Follow-Ups:
- Re: multitexturing and combiners problems
- From: fungus
- Re: multitexturing and combiners problems
- References:
- multitexturing and combiners problems
- From: halex2000
- Re: multitexturing and combiners problems
- From: Maik Wagner
- Re: multitexturing and combiners problems
- From: halex2000
- Re: multitexturing and combiners problems
- From: Dave Eberly
- Re: multitexturing and combiners problems
- From: fungus
- Re: multitexturing and combiners problems
- From: Dave Eberly
- Re: multitexturing and combiners problems
- From: fungus
- multitexturing and combiners problems
- Prev by Date: Re: multitexturing and combiners problems
- Next by Date: Blending in Cg
- Previous by thread: Re: multitexturing and combiners problems
- Next by thread: Re: multitexturing and combiners problems
- Index(es):
Relevant Pages
|