• Create Account

## wp8 problem

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.

3 replies to this topic

### #1Andrey.Mesheryakov  Members

Posted 29 September 2013 - 06:23 AM

Hello!

I'm trying to make something on wp8 using dx11. And I have one bug. I'm trying to draw a picture with transparency.gpApp->m_deviceContext->IASetVertexBuffers( 0, 1, vertexbuffer.GetAddressOf(), &stride, &offset );
gpApp->m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
gpApp->m_deviceContext->Draw( 3 * trianglesCount, 0 );

And all looks ok -

.

I see transparent square on a picture.

But then I minimizing the app the transparent part is going black -

struct VertexShaderInput
{
float4 pos : POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

{
float4 pos : SV_POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

{

output.pos = input.pos;
output.texcoord = input.texcoord;
output.color = input.color;

return output;
}
----------------------------------------------------

Texture2D Texture;
SamplerState ss;

{
float4 pos : SV_POSITION;
float4 color : COLOR0;
float2 texcoord : TEXCOORD;
};

float4 main(PixelShaderInput input) : SV_TARGET
{
return Texture.Sample(ss, input.texcoord);
//return input.color * Texture.Sample(ss, input.texcoord);
}

----------------------------------------------------

Please give me a direction that I have done wrong. Any ideas! Thanks!

Edited by Andrey.Mesheryakov, 29 September 2013 - 07:54 AM.

### #2Migi0027 (肉コーダ)  Members

Posted 29 September 2013 - 06:43 AM

We can safely assume that wp8 is Windows Phone 8, right? (Just have to ask)

• To simplify our lives, put the code in the <> tool your thread editor gives you. (It makes it more readable  )
• Can we see your blend state, how is it defined?
• Is the red in the background automatic, or is it something you draw as well? (Order matters!)

-MIGI0027

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/cuboidzone.wordpress.com/

### #3Andrey.Mesheryakov  Members

Posted 29 September 2013 - 08:01 AM

Yes, wp8 mean Windows Phone 8.

Here is blend state creation -

D3D11_BLEND_DESC bd;
bd.RenderTarget[0].BlendEnable = TRUE;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
bd.IndependentBlendEnable = FALSE;
bd.AlphaToCoverageEnable = FALSE;

DX::ThrowIfFailed( m_device->CreateBlendState(&bd, &m_blendNormal) );


Red background is from here -

float blendFactor[] = {1.0f, 1.0f, 1.0f, 1.0f};
m_deviceContext->ClearRenderTargetView( m_rendertarget.Get(), color );


Edited by Andrey.Mesheryakov, 29 September 2013 - 08:02 AM.

### #4Andrey.Mesheryakov  Members

Posted 29 September 2013 - 09:22 AM

Fixed. Blend state should be -

D3D11_BLEND_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.RenderTarget[0].BlendEnable = TRUE;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
bd.AlphaToCoverageEnable = FALSE;