Dx9 C# RenderStates
I'm having troubles converting this from VB6 DX8 to C# DX9
D3DDevice.SetRenderState D3DRS_LIGHTING, False
D3DDevice.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA
D3DDevice.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA
D3DDevice.SetRenderState D3DRS_ALPHABLENDENABLE, True
so far I have this running with no errors.
device.SetRenderState(Direct3D.RenderStates.Lighting,false);
//device.SetRenderState(Direct3D.RenderStates.SourceBlend, ????);
//device.SetRenderStates(Direct3D.RenderStates.DestinationBlend, ??
device.SetRenderState(Direct3D.RenderStates.AlphaBlendEnable,true);
any ideas. i'm trying to do transparency's.
For setting the blend argument, you can use Blend.SourceAlpha and Blend.InvSourceAlpha.
Using the device.RenderState.* properties sometimes works out more reliable than using the SetRenderState function directly in my experience btw. I don't know why, but sometimes the renderstates just wouldn't be set properly with the function. You can use these properties like this for example:
device.RenderState.Lighting = false;
device.RenderState.SourceBlend = Blend.SourceAlpha;
Using the device.RenderState.* properties sometimes works out more reliable than using the SetRenderState function directly in my experience btw. I don't know why, but sometimes the renderstates just wouldn't be set properly with the function. You can use these properties like this for example:
device.RenderState.Lighting = false;
device.RenderState.SourceBlend = Blend.SourceAlpha;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement