Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

2D Mirror Blend

4: Adsense

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   

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.




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.