/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

Image of the Day

What's the best way to move your heavy stuff? Using a power loader! #spacr #screenshotsaturday 💪🤖💪 https://t.co/sOjz2XNVeq
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

wp8 problem

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
3 replies to this topic

#1 Andrey.Mesheryakov   Members   

102
Like
0Likes
Like

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->PSSetShaderResources( 0, 1, pImage->m_texture.GetAddressOf() );
gpApp->m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
gpApp->m_deviceContext->Draw( 3 * trianglesCount, 0 );
 

And all looks ok - 

runjpg_5973997_9210037.jpg.

I see transparent square on a picture.

 

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

suspendjpg_3882626_9210046.jpg

 

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


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


VertexShaderOutput main(VertexShaderInput input)
{
  VertexShaderOutput output;


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


  return output;
}
----------------------------------------------------
 
pixel shader----------------------------------------
Texture2D Texture;
SamplerState ss;


struct PixelShaderInput
{
  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.


#2 Migi0027 (肉コーダ)   Members   

4463
Like
0Likes
Like

Posted 29 September 2013 - 06:43 AM

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

  • Your shader code seems fine
  • To simplify our lives, put the code in the <> tool your thread editor gives you. (It makes it more readable wink.png )
  • 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/


#3 Andrey.Mesheryakov   Members   

102
Like
0Likes
Like

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].BlendOp = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; 
bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
bd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
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.


#4 Andrey.Mesheryakov   Members   

102
Like
0Likes
Like

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].BlendOp = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; 
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.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
bd.IndependentBlendEnable = FALSE;
bd.AlphaToCoverageEnable = FALSE;





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.