glsl内置变量
gl_Position
contains the position of the current vertex
gl_PointSize
contains size of rasterized points, in pixels
gl_PointCoord
contains the coordinate of a fragment within a point
gl_FrontFacing
indicates whether a primitive is front or back facing
gl_FragCoord
contains the window-relative coordinates of the current fragment
gl_FragColor
gl_FragColor is deprecated. You should use the following syntax:
layout(location = 0) out vec4 diffuseColor;
本文详细介绍了GLSL中的几个关键内置变量,包括gl_Position用于设置顶点位置,gl_PointSize控制点的像素大小,gl_PointCoord表示点内碎片坐标,gl_FrontFacing指示面是否正向,以及gl_FragCoord和gl_FragColor分别用于确定片段的窗口坐标和颜色。值得注意的是,gl_FragColor已被弃用,推荐使用布局定位的输出变量来替代。
1983

被折叠的 条评论
为什么被折叠?



