1.3 deprecated variables

I have added “#version 130” to my shaders and they work in the same way and with the same performance. But I have received a good quantity of deprecated warnings.

I am used to use gl_vertex, gl_normal, gl_ModelViewMatrix and go on… I have looked in the 1.3 spec but I only find they are deprecated but there is no solution…

So my questions are… Why have they been deprecated? Should I use uniform variables to send that information? is going to improve the performance if I change deprecated variables?

I have another doubt… I have heard that I shouldnt combine alpha and depth test or if I do it, the depth buffer is not updated by itself so I should sort the objects… Could you give any reference about this topic? I have heard too if I do billboarding in vertex shader I should sort the objects…

Thanks for sharing your knowledge.

Capagris

gl_… variables ar leftover from fixed-function pipeline. Nowdays video cards are very universal and have flexible system. So no need for fixed variable naming and semantics. You can use whatever names/types you want for variables. So yes - use user defined uniforms and vertex attributes for deprecated stuff.

I have heard that I shouldnt combine alpha and depth test

I don’t see the problem with enabling alpha test and depth test. I think you should to eliminate hidden parts but disable depth writing. You also have to sort all transparent objects.

>> gl_vertex, gl_normal, gl_ModelViewMatrix

see the glsl spec
vertex,normal are inbuilt vertex attributes

  • mv matrix is an inbuilt uniform

>>I don’t see the problem with enabling alpha test and depth test
some hardware is slower if u have alphatest enabled, since there is the possibility the fragment will fail the alphatest + wont be written (similar with stencil test etc), theres info out there on how to achieve the bast performance WRT depth writes

>>the depth buffer is not updated by itself so I should sort the objects
incorrect with alphatest, the depth buffer is still updated (if the alpahtest passes that is). i.e. theres no need to sort

Ok, so for example, I should declare gl_vertex

in vec4 gl_vertex;
in mat4 gl_ModelViewMatrix;

is that?

I would like to know if I dont specify anything for an out(vertex) or in(fragment) variable, is it smooth or noperspective interpolation?

Zed, I think it is necessary to sort… I have find this…

Depth Buffering

Depth buffering is simple, efficient, and it gives perfect results, as long as you only draw opaque objects. But it doesn’t work at all for alpha blended objects!

This is because the depth buffer only keeps track of the closest pixel that has been drawn so far. For opaque objects, that is all you need.

So, if I want to use alpha test I think I will need to sort my objects first…

Using discard command could be understood as using blending?