Jump to content
  • Advertisement
Sign in to follow this  
Hooch180

[SlimDx] How to set render states and dispose them?

This topic is 2631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello.
I want to set states in SlimDX Direct3d9 device.

I have that code at the beging of frameRender function.

device.BeginStateBlock();
device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.Lighting, false);
device.SetRenderState(RenderState.CullMode, Cull.None);
device.EndStateBlock();

But I'm getting this error in debug window:

Object of type SlimDX.Direct3D9.StateBlock was not disposed. Stack trace of object creation:

I'm getting millions of those lines. All of them say the same thing.
How should I dispose those states? How to make it in proper way?

Share this post


Link to post
Share on other sites
Advertisement
In my Initialize function I added:


device.BeginStateBlock();
device.SetRenderState(RenderState.ZEnable, false);
device.SetRenderState(RenderState.Lighting, false);
device.SetRenderState(RenderState.CullMode, Cull.None);
myStateBlock = device.EndStateBlock();

then I dispose that in my clean function.

And In every frame at the beging after Clear(.....) i added myStateBlock.Apply(). Is this good?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!