0
votes

While trying to get the gist of OpenGL, I eventually ran into GLSL. I have used OpenGL before for miminal things, like triangles and colors (since I haven't learnt much yet), but when I found out about deprecated functions like glBegin and glEnd, I had to unlearn the things I had just learnt.

Now, I have come across vertex buffers, vertex buffer objects, vertex and fragments shaders... One thing I never understood though is why should one use GLSL? Why use GLSL along with OpenGL? What are the things you can't do using pure OpenGL? To me integrating GLSL shaders into programs adds complexity, since you have deal with external files or you have to embed shaders into programs, which causes more work.

I have very little experience. I'd like to learn more about the subject, but because of this incomprehensible contradiction, I'm unable to progress.

So, why use GLSL along with OpenGL?

1
Well, OpenGL doesn't tell your graphics hardware how to draw something, just what to draw. The deprecated functions used to pre-package the "how" for you. Now you need to do it yourself. My understanding of OpenGL/GLSL isn't exactly top-notch and I don't have a complete answer, therefore this comment.Hydronium
@Hydronium: OK, this helps a little, though. Thanks, I appreciate the gesture.Helixirr

1 Answers

3
votes

Your question is not about GLSL; it's about shaders in general. GLSL is just the sanctioned way to provide shaders in OpenGL. Your question is really, "Why use shaders along with OpenGL?"

I'm not going to get into all of the details of what shaders can do that fixed function cannot. But here are just a few of the things that you cannot do with fixed-function OpenGL:

I can keep going (for a long time), but I think you get the point. If you actually care about little things like "visual fidelity", you should be using shaders.

The question isn't "why use shaders;" it's "why not use shaders?"