Jump to content
  • Advertisement
Sign in to follow this  
Kalagaraz

MDX C# Shaders

This topic is 4440 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

Hey was reading around and a bunch of people are saying to stay away from fixed function pipeline when learning directX now because it isn't going to be in directX. So I thought I would try and learn shaders. Currently all I know about directX is how to create a device and draw a triangle. MDXInfo has a lot of tutorials on HLSL shaders, but it only teaches you how to create the shader file. What I want to know is how do you load the shader file into directX in C#?

Share this post


Link to post
Share on other sites
Advertisement
Our tutorials use the DirectX Effects framework for that. If you check out the 1st HLSL tutorial, you'll find the shader loading code in the Engine.cs file. On line 44 of this class (VS2003 project) you'll find the following line:

effect = Effect.FromFile(renderer.Device, "Resources/shaders/diffuse.fx", null, 
null, ShaderFlags.PartialPrecision, null);

That's really all there is to loading shaders in Direct3D. This line will load the specified shader and compile it for use on your device. You can find more information on this method and it's parameters and overloads in the SDK documentation.

Hope this answers your question.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!