Dx9 C# RenderStates

Started by
1 comment, last by psychotomus 17 years, 3 months ago
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.
Advertisement
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;
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
thanks. That would of helped if i didnt find the answer first in Dx SDK, took about 3-4 hours of digging though.

This topic is closed to new replies.

Advertisement