PDA

View Full Version : i give up - need help with multi-texture



finster
11-06-2003, 05:11 PM
to simplify the problem

i have a triangle i would like to render with two textures

both textures have alpha
for this example imagine the base texture is a vertical line with everthing else transparent

the second texture is a horizontal line with everything else transparent

if everything worked the way i want i would see a '+' on the screen with whatever was alread on the screen showing the through the non-'+' areas

i've looked everywhere at the few samples available and can't get any to do what i want (although i have seen quite few interest things)

in the examples i found the base texture was always opaque. i need both layers to be alpha blended

help

OpenGL guy
11-06-2003, 05:31 PM
I'm rusty in my OpenGL syntax, so take the following as pseudocode:
- Set stage 0 to modulate texture 0 with diffuse color
- Set stage 1 to add texture 1 to the current color (which is texture 0 modulated with diffuse color)
- Now the places where alpha is non-zero are the places where (texture 1 + (texture 0 * diffuse color)) has non-zero alpha
- Set your blend func to something like SRCBLEND = srcAlpha, DSTBLEND = invSrcAlpha and enable blending.

I believe this does the trick.


[This message has been edited by OpenGL guy (edited 11-06-2003).]

JasonM [ATI]
11-06-2003, 06:44 PM
If you're trying to get your head around ARB_multitexture for the first time, I recommend playing around with OGL Multex (http://mirror.ati.com/developer/sdk/rage128sdk/Multex/OGLMultex.html) , which allows you to tweak multitexture state via a visual interface and see the rendered results interactively. Pay attention to how the color coded data logically flows through the two stages of the multitexture cascade.

You can also open the code window and watch the code change accordingly.

Once it's set the way you want it, you can grab the code and paste it into your own app. You can also load your own stripe textures as the two textures that OGL Multex uses so that you can get your specific effect working.

-Jason

[This message has been edited by JasonM [ATI] (edited 11-06-2003).]

finster
11-06-2003, 07:45 PM
Originally posted by JasonM [ATI]:
If you're trying to get your head around ARB_multitexture for the first time, I recommend playing around with OGL Multex (http://mirror.ati.com/developer/sdk/rage128sdk/Multex/OGLMultex.html) , which allows you to tweak multitexture state via a visual interface and see the rendered results interactively. Pay attention to how the color coded data logically flows through the two stages of the multitexture cascade.

You can also open the code window and watch the code change accordingly.

Once it's set the way you want it, you can grab the code and paste it into your own app. You can also load your own stripe textures as the two textures that OGL Multex uses so that you can get your specific effect working.

-Jason

[This message has been edited by JasonM [ATI] (edited 11-06-2003).]

funny thing i had tried a link to that program earlier in the day and it hadn't worked. now it worked and after fiddling with it awhile i got what i wanted.

thanks!

cwc36
11-06-2003, 07:51 PM
Hi,
Try to look at http://myopendemo.hypermart.net/opengl3.htm