Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Direct3D + ActiveX


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

#1 fdialke   Members   -  Reputation: 111

Like
0Likes
Like

Posted 10 April 2014 - 11:23 PM

Hi there.

 

I've made an application builded on common separate window with some transparent cubes. All looks good, transparent is transparent and so on.

Then I've moved all my code to ATL ActiveX Control, and now transparent figure became just textured white (texture has white background) cube.

 

Why there is so difference ? How can I manage it ?


Edited by fdialke, 11 April 2014 - 03:55 AM.


Sponsor:

#2 Nik02   Crossbones+   -  Reputation: 3193

Like
0Likes
Like

Posted 11 April 2014 - 08:52 AM

Screenshots?

 

Without seeing the issue, I would guess that you try to load a texture from a path relative to the executable, and it fails. 

 

Based on the information so far, it is very difficult to assess the problem.


Niko Suni


#3 fdialke   Members   -  Reputation: 111

Like
0Likes
Like

Posted 11 April 2014 - 01:04 PM

https://imageshack.com/i/m94v69j

https://imageshack.com/i/gv46kij

md3dImmediateContext->OMSetBlendState(TransparentBS, blendFactor, 0xffffffff);
activeTech->GetPassByIndex(p)->Apply(0, md3dImmediateContext);

md3dImmediateContext->RSSetState(CCWcullMode);
md3dImmediateContext->DrawIndexed(mTransparentVICount, 0, 0);

md3dImmediateContext->RSSetState(CWcullMode);
md3dImmediateContext->DrawIndexed(mTransparentVICount, 0, 0);

md3dImmediateContext->OMSetBlendState(0, blendFactor, 0xffffffff);


Edited by fdialke, 11 April 2014 - 01:46 PM.


#4 fdialke   Members   -  Reputation: 111

Like
0Likes
Like

Posted 11 April 2014 - 02:46 PM

I've made this PS shader now

float4 PS_TransparentCube(VertexOut pin, uniform int gLightCount) : SV_Target
{
// Interpolating normal can unnormalize it, so normalize it.
    pin.NormalW = normalize(pin.NormalW);


// The toEye vector is used in lighting.
float3 toEye = gEyePosW - pin.PosW;


// Cache the distance to the eye from this surface point.
float distToEye = length(toEye); 


// Normalize.
toEye /= distToEye;


    // Default to multiplicative identity.
    float4 texColor = float4(1, 1, 1, 1);


// Sample texture.
texColor = gTransparentMap.Sample( samAnisotropic, pin.Tex );


texColor.a = 0.1f;
return texColor;
}
 
so now cube has no lights, still window application has transparency and ActiveX shows white cube


#5 fdialke   Members   -  Reputation: 111

Like
0Likes
Like

Posted 13 April 2014 - 02:04 PM

well, I've made it work, but don't know why that didn't 

I've included SetBlendState right into techinque:

technique11 Light2TexTransparent
{
    pass P0
    {
        SetVertexShader( CompileShader( vs_5_0, VS_TransparentCube() ) );
SetGeometryShader( NULL );
SetBlendState(EnableBlend, float4( 0.1f, 0.1f, 0.1f, 0.1f ), 0xFFFFFFFF);
        SetPixelShader( CompileShader( ps_5_0, PS_TransparentCube(2) ) );
    }
}
BlendState EnableBlend
{
BlendEnable[0] = TRUE;
SrcBlend[0] = 5;
DestBlend[0] = 6;
BlendOp[0] = 1;
SrcBlendAlpha[0] = 2;
DestBlendAlpha[0] = 1;
BlendOpAlpha[0] = 1;
RenderTargetWriteMask[0] = 15;
};
 
may somebody explain me why OMSetBlendState didn't work, but SetBlendState fixed it ?
 





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