Confused about shaders

Started by
0 comments, last by jollyjeffers 19 years, 8 months ago
I'm confused about pixel- and vertex-shaders. I've read about the neat things you can create but how does it all work? What's the diffrence between HLSL and CG? which is preffered? and how do I apply these shaders to my application in an easy way? Does ATI cards handle shaders the same way as nVidia(i.e. can I write a shader that works the same way on all cards that supports them)? A lot of questions. As I said, I'm confused. Is there a good website somewhere that might help? Thanks in advance!
Advertisement
Shaders are small pieces of assembly-like code that are executed by the GPU (Graphics Programming Unit) - a piece of technology that is specifically designed for the task and hence can do it blisteringly fast.

Quote:What's the diffrence between HLSL and CG? which is preffered?
Theoretically there is no difference - they are both high level languages that allow you to use a slightly more friendly syntax to describe/write the shaders. HLSL is only for DirectX whereas CG is opengl/directx. If you're sticking with windows/DX development then HLSL is probably best, otherwise CG. However there is no right/wrong answer as to which is best.

Quote:how do I apply these shaders to my application in an easy way?
I dont know anything much about OpenGL, but in DX there are lots of SDK samples and a fairly easy set of function calls to load/compile/configure shaders (or effects). In the later revisions of DX it's got a lot lot easier..

Quote:can I write a shader that works the same way on all cards that supports them?
Yes. However there are some cases where some cards support things slightly better than others / give better quality results... but if you're only just getting started, there's no need to worry about this..

Quote:Is there a good website somewhere that might help?
There are lots and lots of resources around. As i said, I'm a DX programmer... but the SDK(Summer 2004) is a brilliant source, as well as google.. and you can pick up a mountain of information just by browsing the OpenGL/DirectX forums on this site. Alternatively, read through the ShaderX thread thats currently active for a short discussion of some of the books.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement