# Fixed-Function vs Shaders: Which for beginner?

I'm currently going to college for computer science. Although I do plan on utilizing an existing engine at some point to create a small game, my aim right now is towards learning the fundamentals: namely, 3D programming. I've already done some research regarding the choice between DirectX and OpenGL, and the general sentiment that came out of that was that whether you choose OpenGL or DirectX as your training-wheels platform, a lot of the knowledge is transferrable to the other platform. Therefore, since OpenGL is supported by more systems (probably a silly reason to choose what to learn), I decided that I'm going to learn OpenGL first.

After I made this decision to learn OpenGL, I did some more research and found out about a dichotomy that I was somehow unaware of all this time: fixed-function OpenGL vs. modern programmable shader-based OpenGL. At first, I thought it was an obvious choice that I should choose to learn shader-based OpenGL since that's what's most commonly used in the industry today. However, I then stumbled upon the very popular Learning Modern 3D Graphics Programming by Jason L. McKesson, located here: http://www.arcsynthesis.org/gltut/

"First, much of what is learned with this approach must be inevitably abandoned when the user encounters a graphics problem that must be solved with programmability. Programmability wipes out almost all of the fixed function pipeline, so the knowledge does not easily transfer."

yet at the same time also makes the case that fixed-functionality provides an easier, more immediate learning curve for beginners by stating:

"It is generally considered easiest to teach neophyte graphics programmers using the fixed function pipeline."

Naturally, you can see why I might be conflicted about which paradigm to learn: Do I spend a lot of time learning (and then later unlearning) the ways of fixed-functionality, or do I choose to start out with shaders? My primary concern is that modern programmable shaders somehow require the programmer to already understand the fixed-function pipeline, but I doubt that's the case.

TL;DR = As an aspiring game graphics programmer, is it in my best interest to learn 3D programming through fixed-functionality or modern shader-based programming?

• There are some similar questions to this as well... – notlesh Jul 9 '12 at 4:46
• "yet at the same time also makes the case that fixed-functionality provides an easier, more immediate learning curve for beginners by stating: " I'm curious. How exactly does that make that case? Because the quote clearly says, "It is generally considered easiest..." (emphasis added). As in, it may be considered true, but that doesn't mean it is true. – Nicol Bolas Jul 9 '12 at 4:46
• Yeah that was an awkward way of wording that. – Rob Hays Jul 9 '12 at 4:56
• The fixed-function pipeline has been deprecated in both OpenGL and DirectX, so I wouldn't waste your time with it. Basic shaders are pretty straightforward, and certainly no more complicated than understanding enough to get a rendering context working. – 3Dave Jul 9 '12 at 6:20

I don't buy the argument that it's easier to start with the fixed-function stuff. It might be the case that the fixed-function lets you do certain things with less code - in fixed-function OpenGL, for instance, you can get some very basic lighting/shading going by doing glEnable(GL_LIGHTING) and a few other calls. The trouble is that as soon as you want something slightly different - per-pixel lighting, say, instead of per-vertex lighting - you have to abandon the fixed-function stuff entirely and write a shader to implement both whatever fixed functionality you were using before, plus whatever you wanted to change.

It just seems like it would be simpler and less confusing to be using shaders the whole time. Shaders do need a bit more setup work as you have a separate source file that needs to be loaded and compiled, some extra C calls to look up and set parameters, etc. But once you've got a shader going, it's the easiest thing to code a few different effects, try out different ideas, etc. And you don't need to care about where the limits of the fixed-function system are and whether it can or can't do what you want; shaders can do whatever you can write code for, modulo the usual limits of performance and memory.

• Cool, thanks for the response. I'll most likely end up just going right for shaders. – Rob Hays Jul 9 '12 at 4:05
• +1 - it's also kinda like "Learning C++" vs "Learning BASIC". It will take you longer to learn C++ but you will have learned more in the long run. – Jonathan Dickinson Jul 12 '12 at 7:46
• I'd like to recommend opengl-tutorial.org . The site explains the basics quite nicely and only uses shaders. – Exilyth Jul 16 '12 at 19:34

I would say to start with fixed function on GLUT. I'm not going to say much about this, but the ideas behind shaders are pretty complicated and the requisite knowledge is basic 3d programming (ie vertex creation and transformation matrices etc). There are a lot more places you can screw up using shaders, there's that much more to code.

Check out my tutorial, and these lighthouse3d ones

I second going straight for shaders. It's not really that much harder to set up, and when you pass that first hurdle you have full power at your fingertips.

More to the point, you'll find that shader programming more closely matches the mathematical equations you see in books and graphics lectures at college.

I would suggest using the fixed function pipeline as a backbone of your program. I find it to be easier to have something show up using it instead of purely shaders. Then, when you know you haven't messed up your vertices or normals, you can slowly but surely inch your way into the shading world.