Go pure OpenGL or GLSL? [closed]

I got interested in studying graphic programming so the obvious entry point was to learn OpenGL. But gathering scattered information around forums and sites, it seems that a pure OpenGL implementation is fading out since most things pre-3.0 are being deprecated and quoting a review on Amazon, "since 3.0 it's all about the shaders". Also of the books that I've seen, looks like only the superbible covers the newer version, but only partially because a good portion of the book teaches deprecated functions, and there are books specifically to GLSL.

This is where I ran into my first problem, some hardwares do not support GLSL, including the notebook with intel integrated graphics that I had planned on using. The function

GLuint vertShader = glCreateShader(GL_VERTEX_SHADER);


causes a segmentation fault and from the looks of it my driver does not support shaders

So my question is, what is the viability of making a game only in OpenGL? will I be missing irreplaceable good features from the shader language? And what kind of hardware (old gen i3, i5, i7, old VGAs) can I expect to run a game with shaders properly?

• GLSL is OpenGL, I think your question is related to whether the hardware you intend on using is OpenGL 3 compatible, not specifically GLSL compatible. Dec 22, 2011 at 0:42
• @Daniel so if a hardware/driver is OpenGL 3.0 compatible it is GLSL compatible? Dec 22, 2011 at 0:45
• GLSL is part of the OpenGL 3.0 specification, so yes, that is the case. Dec 22, 2011 at 0:58
• You say, "from the looks of it my driver does not support shaders." What version of OpenGL are you getting? Are you correctly loading all the available OpenGL functions? Dec 22, 2011 at 1:05
• @Papavoikos: If it returns NULL, you've got much bigger problems than whether to use shaders. Are you creating your OpenGL context correctly? Remember: you can't call any GL functions until you have a valid context created and made current. Dec 22, 2011 at 17:49

Shader code is definitely clearer and easier to understand than a mess of glTexEnv, glTexGen and texture matrix calls, and has the bonus that you can express any more-or-less arbitrary math operation using it (which you can't do with the fixed pipeline - what you're calling "pure OpenGL"). The only potential downside is that you need to write a certain amount of supporting infrastructure in your code before you can begin to use them, whereas with the old way you can pretty much dive right in. I call that a "potential" downside because I actually think that it makes you prepare things and learn a little more in advance - OpenGL has a reputation for being "easy" and you occasionally do see people being fooled by this and diving right in without really knowing what they're doing first, which does not stand to their good in the longer term.

Hardware-wise you can rely on almost anything released in the past 5/6/7 years to have some degree of shader support, but - in the case of older Intels (some of the 9xx series) - it's not going to be GLSL, but will instead be the older GL_ARB_vertex_program and GL_ARB_fragment_program extensions. These use an assembly language-like shader language, but - confession time - I'm personally quite fond of it. It's actually quite easy to use, if lacking in some more modern features (such as branching) and requiring more lines of shader code to do the same thing. The supporting infrastructure required in your main program for these extensions is a lot more lightweight than for GLSL too.

That's not to say that I'd recommend them over GLSL however, but they are an option that is there if you really need to run on this class of hardware and it's useful to be aware that they exist, which brings me to the final point. Are you really certain that you really need to run on this class of hardware (e.g in the case of your notebook you may have just neglected to get the entry points)?

• I completely neglected the fact that Mesa3d is still on opengl 2.1 specification. I'll fix that Dec 22, 2011 at 11:38

It should also be noted that there is no "pure OpenGL" anymore.

OpenGL ES 2.0 ditched all non-shader stuff, and since WebGL is based on it, it too only works with shaders. OpenGL 3.0 deprecated all of the fixed-function stuff, and 3.1 removed it (in core profiles. Most implementations support compatibility profiles, but MacOSX does not for their 3.2 implementation).

So I wouldn't suggest learning non-shader OpenGL.

If you've done any programming in the past, writing your own shader code using GLSL will be much more enjoyable. I originally tried learning fixed-function OpenGL and it was harder for me because it didn't make sense. Then I tried to learn GLSL using the orange book and it was much easier and made more since. Just my 2 cents.

I would definitely go towards GLSL because of the power to write programs for the GPU.