Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


2D Mirror Blend


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 jeftay   Members   -  Reputation: 105

Like
0Likes
Like

Posted 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.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS