I saw the ftransform() function while learning about Minecraft shaders.

gl_Position = ftransform(); TexCoords = gl_MultiTexCoord0.st; 

Here is an example use in a Vertex Shader. (.vsh file) The docs for GLSL 1.20 does not give details at all about its implementation.

Does the above code do the same thing as the following:

gl_Position = mat3(gbufferModelViewInverse) * (gl_NormalMatrix * gl_Normal); TexCoords = gl_MultiTexCoord0.st; 
2

1 Answer

See the specification The OpenGL® Shading Language, Version 4.60 - 8.5. Geometric Functions:

Available only when using the compatibility profile. For core OpenGL, use invariant. For vertex shaders only. This function will ensure that the incoming vertex value will be transformed in a way that produces exactly the same result as would be produced by OpenGL’s fixed functionality transform. It is intended to be used to compute gl_Position

So ftransform() does the same as:

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.