Jump to content
  • Advertisement
Sign in to follow this  
chipmeisterc

OpenGL DX9 SDK Examples - Difference between shader and effect?

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

Hi Guys! I have always been an OpenGl guy, but recently after moving house and lacking an internet connection at home, i noticed the wealth of example apps / tutorials included with the SDK and figured I'd try my hand at some direct x programming. This has been pretty sucessfull :- I have written my own app, which creates a DX9 device, has keyboard and mouse direct input, and can load texture light and render models in my own format exported from max, and display on screen text text, so its all comming along nicely. Yesterday I decided to try and integrate some shaders into my app, so I had a look through the Basic HLSL example which is the 'tiny' model expanding and collapsing on a sin wave vertex shader, and integrated it into my progect afer modulising it to make it reusable. However one thing I have noticed in the documentation is that there seems to be a difference between a 'shader' and an 'effect'. I am currently loading a .fx file but I have noticed there are also .hlsl files? There is also a HLSL without effects demo which is the wave vertex displacement on a flat plane this uses a .hlsl file. This seems slightly different from my previous experiences with GLSL and just having a fragment and vertex shader. Can anyone shed any light on this ? Thankyou :)

Share this post


Link to post
Share on other sites
Advertisement
Anyone?

After looking on the internet a little more it would seem that a 'shader' is just a vertex / fragment program or single shader technique.

where as an effect (.fx) uses the microsoft effect framework with which you can specify multiple techniques for differing pc configurations as well as set up multiple render passes, basically manage the different pipeline/shader states?

Am I on the right lines here?

Share this post


Link to post
Share on other sites
Yep, you're right.
A common mistake is to think that effect frameworks are related just to vertex and pixel shaders plus some settings. But "effect" is ment as a "setup" of the whole rendering process, shaders are just a part (optional part!) of it.

You can make an effect which will use only the fixed pipeline, so no shaders - you can use it to set all the rendering states, texture samplers, transformation matrixes, lights (you can completely specify the lights in effect file, not just turn them on/off), materials (again - completely specify, not just use materials defined elsewhere) etc.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!