英文:
Does ftransform() in GLSL 1.20 do the same thing as mat3(gbufferModelViewInverse) * (gl_NormalMatrix * gl_Normal)?
问题
我在学习有关Minecraft着色器时看到了ftransform()函数。
gl_Position = ftransform();
TexCoords = gl_MultiTexCoord0.st;
这是在顶点着色器中的一个示例用法(.vsh文件)。GLSL 1.20的文档没有提供关于它的实现细节。
上面的代码是否与以下代码执行相同的操作:
gl_Position = mat3(gbufferModelViewInverse) * (gl_NormalMatrix * gl_Normal);
TexCoords = gl_MultiTexCoord0.st;
英文:
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;
答案1
得分: 0
查看规范OpenGL® Shading Language,版本4.60 - 8.5. 几何函数:
> 仅在使用兼容性配置文件时可用。对于核心OpenGL,请使用不变量。
仅适用于顶点着色器。此函数将确保传入的顶点值以一种方式转换,以产生与OpenGL的固定功能转换产生的完全相同的结果。它旨在用于计算gl_Position
。
因此,ftransform()
与以下内容相同:
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
英文:
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;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论