gpt4 book ai didi

javascript - WebGL着色器变量列表?

转载 作者:行者123 更新时间:2023-12-03 07:25:56 24 4
gpt4 key购买 nike

例如:

var VertexShaderText = [

'attribute vec2 vertPosition;',

'void main()',
'{',
' gl_Position = vec4(vertPosition, 0.0, 1.0);',
'}'
].join('\n');

除了gl_Position之外,可以使用其他所有WebGL着色器变量在线列出的列表吗?

最佳答案

您可以在the specthe WebGL reference card中找到它

引用卡列出了所有这些

Built-In Inputs, Outputs, and Constants [7]

Shader programs use Special Variables to communicate with fixed-function parts of the pipeline. Output Special Variables may be read back after writing. Input Special Variables are read-only. All Special Variables have global scope.

Vertex Shader Special Variables [7.1]

Outputs:
Variable Description Units or coordinate system
--------------------------------------------------------------------------------------
highp vec4 gl_Position; transformed vertex position clip coordinates
mediump float gl_PointSize; transformed point size pixels
(point rasterization only)

Fragment Shader Special Variables [7.2]

Fragment shaders may write to gl_FragColor or to one or more elements of gl_FragData[], but not both. The size of the gl_FragData array is given by the built-in constant gl_MaxDrawBuffers.

Inputs:
Variable Description Units or coordinate system
-----------------------------------------------------------------------------------------------
mediump vec4 gl_FragCoord; fragment position within window coordinates
frame buffer
bool gl_FrontFacing; fragment belongs to a Boolean
front-facing primitive
mediump vec2 gl_PointCoord; fragment position within a 0.0 to 1.0
point (point rasterization for each
only) component

Outputs:
Variable Description Units or coordinate system
-----------------------------------------------------------------------------------------------
mediump vec4 gl_FragColor; fragment color RGBA color
mediump vec4 gl_FragData[n] fragment color for RGBA color
color attachment n

Built-In Constants With Minimum Values [7.4]

Built-in Constant                                  Minimum value
----------------------------------------------------------------
const mediump int gl_MaxVertexAttribs 8
const mediump int gl_MaxVertexUniformVectors 128
const mediump int gl_MaxVaryingVectors 8
const mediump int gl_MaxVertexTextureImageUnits 0
const mediump int gl_MaxCombinedTextureImageUnits 8
const mediump int gl_MaxTextureImageUnits 8
const mediump int gl_MaxFragmentUniformVectors 16
const mediump int gl_MaxDrawBuffers 1

Built-In Uniform State [7.5]

Specifies depth range in window coordinates. If an implementation does not support highp precision in the fragment language, and state is listed as highp, then that state will only be available as mediump in the fragment language.

struct gl_DepthRangeParameters {
highp float near; // n
highp float far; // f
highp float diff; // f - n
};
uniform gl_DepthRangeParameters gl_DepthRange;

关于javascript - WebGL着色器变量列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42139130/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com