Why do I need GLSL?

Started by
4 comments, last by bronxbomber92 11 years, 8 months ago
I don't understand why I need to learn GLSL.
What are some stuff that is not possible to do in normal OpenGL, but possible with GLSL
An invisible text.
Advertisement
My 'normal' I assume you mean fixed-function pipeline.

Here's a good example: Steep Parallax Mapping:

http://graphics.cs.brown.edu/games/SteepParallax/

They show 4 images. Texture mapping is done in basic fixed-function opengl. You can also do some normal mapping in fixed-function opengl extensions. Even per-pixel normal mapping through the dot-product texture combiner. If you set the right opengl options and parameters, you can do some pretty cool looking stuff.

But the last two, parallel mapping, and steep parallax mapping, require very specific, per-pixel operations. These operations are written in GLSL. Before GLSL, everything you needed OpenGL to do has to have been thought of before hand and built into opengl. Examples are things like turning lights on and off, adjusting fog, etc. It's all pre-made, and all you do is turn it on or off and set some parameters. GLSL lets you ADD and invent NEW things the creators of OpenGL never thought of yet.
"normal OpenGL" (AKA fixed function) is deprecated and emulated on modern GPUs. When you use fixed function rendering, then you're simply using the driver's basic built-in GLSL routines.
GLSL isn't necessary, as the drivers still allow the fixed function rendering. But if you want your application to execute on OpenGL ES, then there is no option.

Or if you want to realize the full power of modern graphics, then you also need GLSL.

If you want to learn and understand better what 3D graphics is, so that you can maybe get a job, then you need to know the modern way. Learning 3D programming with the fixed function pipeline is partly wasted, as it is done differently now, you will have to re-learn again.

See Learning Modern 3D Graphics Programming or http://www.opengl-tutorial.org/ for a good tutorials. Learning OpenGL requires a lot of effort.
[size=2]Current project: Ephenation.
[size=2]Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/
While it may be easier to get off the ground with out GLSL, GLSL is just so powerful. It's like the difference between a tricycle and a sports car.

I'm personally a fan of its hardware accelerated image processing.

Learn to make games with my SDL 2 Tutorials


I don't understand why I need to learn GLSL.
What are some stuff that is not possible to do in normal OpenGL, but possible with GLSL

For modern OpenGL development there is no practical difference between GLSL (or more broadly, shaders, for which GLSL is a language to write shaders) and OpenGL.

Originally when OpenGL was conceived graphic processing units were only capable of performing a fixed-set of operations. Thus, OpenGL's API was designed to only expose what the graphic cards were capable of doing, and this it what came to be called the fixed function pipeline. But as time has passed, graphic processing units have evolved. They no longer expose just a fixed-set of operations; they still have a small set of fixed operations, but now also include the ability to be programmed (similar to how we can program our CPUs with C or C++ or Java or <insert favourite language>). The ability to program a GPU is important because now what is possible to do with a GPU is much less limited. However, we need a way to be able to program the GPUs, and hence OpenGL has evolved alongside the GPUs capabilities; this is why shaders were introduced.

The bottom line is that GLSL is only necessary to learn if you intend to use features that are beyond the capabilities of the fixed function pipeline. Vaguely, the fixed function pipeline is only capable of fog, vertex lighting, coloring, and texturing. If you're requirements are more sophisticated than that, then you need shaders.

This topic is closed to new replies.

Advertisement