OpenGL default matrices and custom shaders

Started by Cornix, August 31, 2013, 11:08:49

Previous topic - Next topic

Cornix

Hello there, I know the title is not the most informative but I really dont know how to make this short.

I would like to use VAO's to draw an image. I want to use a custom shader to define the input I get.
I also want to use the default ModelView, Texture and Projection-matrices of OpenGL if possible.
Why do I want to use these? Because they are already there.
I know that I am supposed to define them myself as uniforms, but why should I do it if they are already implemented by openGL? Seems kind of wasteful to me to write the exact same code once again.

So I would like to know if there is some way to mix these versions together or if this is absolutely not possible.

Thanks in advance.

quew8

It isn't bloody mindedness that they don't let you get at them in GLSL 1.3+. They are deprecated. Hardware vendors are under no obligation to support them and will probably do so in software. I severely advise against using them although if you really want to then you can use GLSL 1.1 or 1.2 which are from before the default matrices were deprecated.

In fact, I use GLSL 1.2 since I like to keep compatibility with hardware at OpenGL 2.1. So I actually have access to those matrices, but I still don't use them. Its not a good idea to use anything that is deprecated.

The LWJGL util.vector Matrix classes have all that you need so you barely have to do anything at all.

Cornix

Well even if the driver implements those matrices at the software level it is probably still faster then doing it myself in java.
Besides, when its already implemented by openGL, why do it again?

If I would use an older version of glsl, would I be missing any functionality? (well, obviously there must be something, but is it anything important?)

quew8

Well as always it is your program and is up to you. Unfortunately I think there are quite a few features you will be missing out on. As to whether you use them is another matter.

-No geometry or tessellation shaders. You could do them in a newer GLSL but I'm not sure how inter operable the two would be.
-No glBindFragDataLocation so no outputting differently to different colour buffers.
-No blocks
-Fewer predefined functions
-I couldn't find any reference for GLSL 1.2 so this is mostly from memory as what hasn't worked for me. I have missed things but I think these are the most important.

Cornix

Thanks again for the information. I will try it out and see how well it works.