PDA

View Full Version : Shaders built in variables and 'fixed functions'



Apollonio
10-12-2016, 07:06 AM
I need to ask if I'm right about how shaders read the built-in variables for example: gl_modelviewprojectionmatrix

If I use old style (deprecated) glrotation, gltranslate etc... I will modify accordingly the current matrix (viewmatix)
when after that I call gl_useprogram the actual built in variable viewmatrix (and those who use it like modelviewprojection) in the shaders will contain the modifed (by glrotate etc) view matrix right?

Am I wrong somewhere?
I ask because i know 'fixed' functions must be used separately from programmable (basically when you start using useprogram), and even if both are now deprecated they are useful for quick applications.

thanks in advance

Apollonio
10-12-2016, 07:09 AM
I wrote wrong: now are deprecated the fixed functions glrotate etc and the built in shaders variables (you should pass by yourself with uniforms)

Apollonio
10-12-2016, 11:11 PM
Not properly, I just wanted a confirm on what I said on first part:

If I use old style (deprecated) glrotation, gltranslate etc... I will modify accordingly the current matrix (viewmatix)
when after that I call gl_useprogram the actual built in variable viewmatrix (and those who use it like modelviewprojection) in the shaders will contain the modifed (by glrotate etc) view matrix right?

Silence
10-13-2016, 12:05 AM
Yes.

This will work as long as your GLSL version is below 1.30. For more recent versions, this does not exist anymore, and you'll have to deal with your own matrices yourself, and on both sides (code and shader).