Jump to content

  • Log In with Google      Sign In   
  • Create Account

jeftay

Member Since 29 Jul 2012
Offline Last Active Nov 23 2012 10:33 PM

Topics I've Started

2D Mirror Blend

29 July 2012 - 12:58 PM

First time post.

Basically I am traying to render a texture that already contains an alpha and also supply an alpha value.

I then need to render a second texture on top of it with its own alpha values.

Here is what I have so far.

Direct3DDevice.SetTexture(0, background);
Direct3DDevice.SetTexture(1, bordertexture);

// This renders my transparent background with an alpha transparency of 50%.
Alpha := Round(255 * (1 - (50 / 100)));
Direct3DDevice.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
Direct3DDevice.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CONSTANT);
Direct3DDevice.SetTextureStageState(0, D3DTSS_CONSTANT, (Alpha SHL 24) OR $FFFFFF);

// This is where It messes up.
// I want to render my border ontop of the background with a 10% transparency on the border only.
Alpha := Round(255 * (1 - (10 / 100)));
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT);
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_BLENDTEXTUREALPHA);
Direct3DDevice.SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CONSTANT);
Direct3DDevice.SetTextureStageState(1, D3DTSS_CONSTANT, (Alpha SHL 24) OR $FFFFFF);

This renders the border with a 10% transparency ontop of the background but instead of the background bleeding through the border, the item below the background is bleeding through, totally ignoring the background color.

Sorry, I am so confused.

Jeff.
Thanks.

PARTNERS