Followers 0

# DX11 wp8 problem

## 3 posts in this topic

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;
};

{
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
0

##### Share on other sites

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

0

##### Share on other sites

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
0

##### Share on other sites

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.IndependentBlendEnable = FALSE;
bd.AlphaToCoverageEnable = FALSE;
0

## Create an account

Register a new account

Followers 0

• ### Similar Content

• Hi Guys,
I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?
Any advice would be greatly appreciated

• bool InitDirect3D::Init() { if (!D3DApp::Init()) { return false; } //Additional Initialization //Disable Alt+Enter Fullscreen Toggle shortkey IDXGIFactory* factory; CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&factory)); factory->MakeWindowAssociation(mhWindow, DXGI_MWA_NO_WINDOW_CHANGES); factory->Release(); return true; }
As stated on the title and displayed on the code above, regardless of it Alt+Enter still takes effect...
I recall something from the book during the swapChain creation, where in order to create it one has to use the same factory used to create the ID3D11Device, therefore I tested and indeed using that same factory indeed it work.
How is that one particular factory related to my window and how come the MakeWindowAssociation won't take effect with a newly created factory?
Also what's even the point of being able to create this Factories if they won't work,?(except from that one associated with the ID3D11Device)
• By ProfL
Can anyone recommend a wrapper for Direct3D 11 that is similarly simple to use as SFML? I don't need all the image formats etc. BUT I want a simple way to open a window, allocate a texture, buffer, shader.

• Q1:
Since there is no more fixed pipeline rendering in DX11, for every part of rendering in DX11, do I need to create a brand-new vertex shader and pixel shader... or at least I have to find one relevant online. If you work on skinned meshes and other effects originally worked in DX9 fixed pipeline, do I have to rework everything by now?

Q2:
For assimp, if it originally was designed for DX9, like it is coupled to a DX9 device for creating meshes and materials etc. Do I have to add in the DX11 device in the assimp, or can I just leave the assimp to remain in DX9 and after the meshes are loaded, I just convert the vertex buffers and index buffers into DX11 buffers?
Thanks
Jack

• This header is mentioned in the book I'm reading but there is no documentation on msdn... Is it like an... outdated and abandoned header?
If so, what's the current default/recomended library for handling errors with directX?

• 18
• 12
• 11
• 27
• 20