Skip to main content
GameDev.net gamedev.net
🔒 Locked

Dx9 C# RenderStates

Started by psychotomus Jan 3, 2007 at 12:53 AM 1 replies 1k views
Original Post
psychotomus
psychotomus
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.
remigius
remigius
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;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.