WebGLRenderingContext.getParameter()
方法在
WebGL API
returns a value for the passed parameter name.
any gl.getParameter(pname);
pname
GLenum
specifying which parameter value to return. See below for possible values.
Depends on the parameter.
You can query the following
pname
parameters when using a
WebGLRenderingContext
.
| 常量 | Returned type | 描述 |
|---|---|---|
gl.ACTIVE_TEXTURE
|
GLenum
|
|
gl.ALIASED_LINE_WIDTH_RANGE
|
Float32Array
(with 2 elements)
|
|
gl.ALIASED_POINT_SIZE_RANGE
|
Float32Array
(with 2 elements)
|
|
gl.ALPHA_BITS
|
GLint
|
|
gl.ARRAY_BUFFER_BINDING
|
WebGLBuffer
|
|
gl.BLEND
|
GLboolean
|
|
gl.BLEND_COLOR
|
Float32Array
(with 4 values)
|
|
gl.BLEND_DST_ALPHA
|
GLenum
|
|
gl.BLEND_DST_RGB
|
GLenum
|
|
gl.BLEND_EQUATION
|
GLenum
|
|
gl.BLEND_EQUATION_ALPHA
|
GLenum
|
|
gl.BLEND_EQUATION_RGB
|
GLenum
|
|
gl.BLEND_SRC_ALPHA
|
GLenum
|
|
gl.BLEND_SRC_RGB
|
GLenum
|
|
gl.BLUE_BITS
|
GLint
|
|
gl.COLOR_CLEAR_VALUE
|
Float32Array
(with 4 values)
|
|
gl.COLOR_WRITEMASK
|
sequence<
GLboolean
> (with 4 values)
|
|
gl.COMPRESSED_TEXTURE_FORMATS
|
Uint32Array
|
Returns the compressed texture formats.
当使用
WEBGL_compressed_texture_s3tc
extension:
当使用
WEBGL_compressed_texture_etc
extension:
WEBGL_compressed_texture_pvrtc
extension:
WEBGL_compressed_texture_etc1
extension:
WEBGL_compressed_texture_atc
extension:
WEBGL_compressed_texture_astc
extension:
|
gl.CULL_FACE
|
GLboolean
|
|
gl.CULL_FACE_MODE
|
GLenum
|
gl.FRONT
,
gl.BACK
or
gl.FRONT_AND_BACK
。另请参阅
cullFace
|
gl.CURRENT_PROGRAM
|
WebGLProgram
or
null
|
见
useProgram
.
|
gl.DEPTH_BITS
|
GLint
|
|
gl.DEPTH_CLEAR_VALUE
|
GLfloat
|
|
gl.DEPTH_FUNC
|
GLenum
|
|
gl.DEPTH_RANGE
|
Float32Array
(with 2 elements)
|
|
gl.DEPTH_TEST
|
GLboolean
|
|
gl.DEPTH_WRITEMASK
|
GLboolean
|
|
gl.DITHER
|
GLboolean
|
|
gl.ELEMENT_ARRAY_BUFFER_BINDING
|
WebGLBuffer
|
|
gl.FRAMEBUFFER_BINDING
|
WebGLFramebuffer
or
null
|
null
corresponds to a binding to the default framebuffer. See also
bindFramebuffer
.
|
gl.FRONT_FACE
|
GLenum
|
gl.CW
or
gl.CCW
。另请参阅
frontFace
.
|
gl.GENERATE_MIPMAP_HINT
|
GLenum
|
gl.FASTEST
,
gl.NICEST
or
gl.DONT_CARE
。另请参阅
hint
.
|
gl.GREEN_BITS
|
GLint
|
|
gl.IMPLEMENTATION_COLOR_READ_FORMAT
|
GLenum
|
|
gl.IMPLEMENTATION_COLOR_READ_TYPE
|
GLenum
|
|
gl.LINE_WIDTH
|
GLfloat
|
|
gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
GLint
|
|
gl.MAX_CUBE_MAP_TEXTURE_SIZE
|
GLint
|
|
gl.MAX_FRAGMENT_UNIFORM_VECTORS
|
GLint
|
|
gl.MAX_RENDERBUFFER_SIZE
|
GLint
|
|
gl.MAX_TEXTURE_IMAGE_UNITS
|
GLint
|
|
gl.MAX_TEXTURE_SIZE
|
GLint
|
|
gl.MAX_VARYING_VECTORS
|
GLint
|
|
gl.MAX_VERTEX_ATTRIBS
|
GLint
|
|
gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS
|
GLint
|
|
gl.MAX_VERTEX_UNIFORM_VECTORS
|
GLint
|
|
gl.MAX_VIEWPORT_DIMS
|
Int32Array
(with 2 elements)
|
|
gl.PACK_ALIGNMENT
|
GLint
|
|
gl.POLYGON_OFFSET_FACTOR
|
GLfloat
|
|
gl.POLYGON_OFFSET_FILL
|
GLboolean
|
|
gl.POLYGON_OFFSET_UNITS
|
GLfloat
|
|
gl.RED_BITS
|
GLint
|
|
gl.RENDERBUFFER_BINDING
|
WebGLRenderbuffer
or
null
|
见
bindRenderbuffer
.
|
gl.RENDERER
|
DOMString
|
|
gl.SAMPLE_BUFFERS
|
GLint
|
|
gl.SAMPLE_COVERAGE_INVERT
|
GLboolean
|
|
gl.SAMPLE_COVERAGE_VALUE
|
GLfloat
|
|
gl.SAMPLES
|
GLint
|
|
gl.SCISSOR_BOX
|
Int32Array
(with 4 elements)
|
|
gl.SCISSOR_TEST
|
GLboolean
|
|
gl.SHADING_LANGUAGE_VERSION
|
DOMString
|
|
gl.STENCIL_BACK_FAIL
|
GLenum
|
|
gl.STENCIL_BACK_FUNC
|
GLenum
|
|
gl.STENCIL_BACK_PASS_DEPTH_FAIL
|
GLenum
|
|
gl.STENCIL_BACK_PASS_DEPTH_PASS
|
GLenum
|
|
gl.STENCIL_BACK_REF
|
GLint
|
|
gl.STENCIL_BACK_VALUE_MASK
|
GLuint
|
|
gl.STENCIL_BACK_WRITEMASK
|
GLuint
|
|
gl.STENCIL_BITS
|
GLint
|
|
gl.STENCIL_CLEAR_VALUE
|
GLint
|
|
gl.STENCIL_FAIL
|
GLenum
|
|
gl.STENCIL_FUNC
|
GLenum
|
|
gl.STENCIL_PASS_DEPTH_FAIL
|
GLenum
|
|
gl.STENCIL_PASS_DEPTH_PASS
|
GLenum
|
|
gl.STENCIL_REF
|
GLint
|
|
gl.STENCIL_TEST
|
GLboolean
|
|
gl.STENCIL_VALUE_MASK
|
GLuint
|
|
gl.STENCIL_WRITEMASK
|
GLuint
|
|
gl.SUBPIXEL_BITS
|
GLint
|
|
gl.TEXTURE_BINDING_2D
|
WebGLTexture
or
null
|
|
gl.TEXTURE_BINDING_CUBE_MAP
|
WebGLTexture
or
null
|
|
gl.UNPACK_ALIGNMENT
|
GLint
|
|
gl.UNPACK_COLORSPACE_CONVERSION_WEBGL
|
GLenum
|
|
gl.UNPACK_FLIP_Y_WEBGL
|
GLboolean
|
|
gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL
|
GLboolean
|
|
gl.VENDOR
|
DOMString
|
|
gl.VERSION
|
DOMString
|
|
gl.VIEWPORT
|
Int32Array
(with 4 elements)
|
You can query the following
pname
parameters when using a
WebGL2RenderingContext
.
| 常量 | Returned type | 描述 |
|---|---|---|
gl.COPY_READ_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.COPY_WRITE_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.DRAW_BUFFER
i
|
GLenum
|
gl.BACK
,
gl.NONE
or
gl.COLOR_ATTACHMENT{0-15}
。另请参阅
drawBuffers
.
|
gl.DRAW_FRAMEBUFFER_BINDING
|
WebGLFramebuffer
or
null
|
null
corresponds to a binding to the default framebuffer. See also
bindFramebuffer
.
|
gl.FRAGMENT_SHADER_DERIVATIVE_HINT
|
GLenum
|
gl.FASTEST
,
gl.NICEST
or
gl.DONT_CARE
。另请参阅
hint
.
|
gl.MAX_3D_TEXTURE_SIZE
|
GLint
|
|
gl.MAX_ARRAY_TEXTURE_LAYERS
|
GLint
|
|
gl.MAX_CLIENT_WAIT_TIMEOUT_WEBGL
|
GLint64
|
|
gl.MAX_COLOR_ATTACHMENTS
|
GLint
|
|
gl.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
|
GLint64
|
|
gl.MAX_COMBINED_UNIFORM_BLOCKS
|
GLint
|
|
gl.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS
|
GLint64
|
|
gl.MAX_DRAW_BUFFERS
|
GLint
|
|
gl.MAX_ELEMENT_INDEX
|
GLint64
|
|
gl.MAX_ELEMENTS_INDICES
|
GLint
|
|
gl.MAX_ELEMENTS_VERTICES
|
GLint
|
|
gl.MAX_FRAGMENT_INPUT_COMPONENTS
|
GLint
|
|
gl.MAX_FRAGMENT_UNIFORM_BLOCKS
|
GLint
|
|
gl.MAX_FRAGMENT_UNIFORM_COMPONENTS
|
GLint
|
|
gl.MAX_PROGRAM_TEXEL_OFFSET
|
GLint
|
|
gl.MAX_SAMPLES
|
GLint
|
|
gl.MAX_SERVER_WAIT_TIMEOUT
|
GLint64
|
|
gl.MAX_TEXTURE_LOD_BIAS
|
GLfloat
|
|
gl.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
|
GLint
|
|
gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS
|
GLint
|
|
gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS
|
GLint
|
|
gl.MAX_UNIFORM_BLOCK_SIZE
|
GLint64
|
|
gl.MAX_UNIFORM_BUFFER_BINDINGS
|
GLint
|
|
gl.MAX_VARYING_COMPONENTS
|
GLint
|
|
gl.MAX_VERTEX_OUTPUT_COMPONENTS
|
GLint
|
|
gl.MAX_VERTEX_UNIFORM_BLOCKS
|
GLint
|
|
gl.MAX_VERTEX_UNIFORM_COMPONENTS
|
GLint
|
|
gl.MIN_PROGRAM_TEXEL_OFFSET
|
GLint
|
|
gl.PACK_ROW_LENGTH
|
GLint
|
见
pixelStorei
.
|
gl.PACK_SKIP_PIXELS
|
GLint
|
见
pixelStorei
.
|
gl.PACK_SKIP_ROWS
|
GLint
|
见
pixelStorei
.
|
gl.PIXEL_PACK_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.PIXEL_UNPACK_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.RASTERIZER_DISCARD
|
GLboolean
|
|
gl.READ_BUFFER
|
GLenum
|
|
gl.READ_FRAMEBUFFER_BINDING
|
WebGLFramebuffer
or
null
|
null
corresponds to a binding to the default framebuffer. See also
bindFramebuffer
.
|
gl.SAMPLE_ALPHA_TO_COVERAGE
|
GLboolean
|
|
gl.SAMPLE_COVERAGE
|
GLboolean
|
|
gl.SAMPLER_BINDING
|
WebGLSampler
or
null
|
见
bindSampler
.
|
gl.TEXTURE_BINDING_2D_ARRAY
|
WebGLTexture
or
null
|
见
bindTexture
.
|
gl.TEXTURE_BINDING_3D
|
WebGLTexture
or
null
|
见
bindTexture
.
|
gl.TRANSFORM_FEEDBACK_ACTIVE
|
GLboolean
|
|
gl.TRANSFORM_FEEDBACK_BINDING
|
WebGLTransformFeedback
or
null
|
见
bindTransformFeedback
.
|
gl.TRANSFORM_FEEDBACK_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.TRANSFORM_FEEDBACK_PAUSED
|
GLboolean
|
|
gl.UNIFORM_BUFFER_BINDING
|
WebGLBuffer
or
null
|
见
bindBuffer
.
|
gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT
|
GLint
|
见
pixelStorei
.
|
gl.UNPACK_IMAGE_HEIGHT
|
GLint
|
见
pixelStorei
.
|
gl.UNPACK_ROW_LENGTH
|
GLint
|
见
pixelStorei
.
|
gl.UNPACK_SKIP_IMAGES
|
GLint
|
见
pixelStorei
.
|
gl.UNPACK_SKIP_PIXELS
|
GLint
|
见
pixelStorei
.
|
gl.UNPACK_SKIP_ROWS
|
GLint
|
见
pixelStorei
.
|
gl.VERTEX_ARRAY_BINDING
|
WebGLVertexArrayObject
or
null
|
见
bindVertexArray
.
|
You can query the following
pname
parameters when using
WebGL extensions
:
| 常量 | Returned type | Extension | 描述 |
|---|---|---|---|
ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
GLfloat
|
EXT_texture_filter_anisotropic
|
Maximum available anisotropy. |
ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OES
|
GLenum
|
OES_standard_derivatives
|
Accuracy of the derivative calculation for the GLSL built-in functions:
dFdx
,
dFdy
,和
fwidth
.
|
ext.MAX_COLOR_ATTACHMENTS_WEBGL
|
GLint
|
WEBGL_draw_buffers
|
The maximum number of framebuffer color attachment points. |
ext.MAX_DRAW_BUFFERS_WEBGL
|
GLint
|
WEBGL_draw_buffers
|
The maximum number of draw buffers. |
ext.DRAW_BUFFER0_WEBGL
|
GLenum
|
WEBGL_draw_buffers
|
Drawing buffers. |
ext.VERTEX_ARRAY_BINDING_OES
|
WebGLVertexArrayObjectOES
|
OES_vertex_array_object
|
Bound vertex array object (VAO). |
ext.TIMESTAMP_EXT
|
GLuint64EXT
|
EXT_disjoint_timer_query
|
The current time. |
ext.GPU_DISJOINT_EXT
|
GLboolean
|
EXT_disjoint_timer_query
|
Returns whether or not the GPU performed any disjoint operation. |
ext.MAX_VIEWS_OVR
|
GLint
|
OVR_multiview2
|
Maximum number of views. |
gl.getParameter(gl.DITHER); gl.getParameter(gl.VERSION); gl.getParameter(gl.VIEWPORT);
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebGL 1.0
The definition of 'getParameter' in that specification. |
推荐 | 初始定义。 |
|
WebGL 2.0
The definition of 'getParameter' in that specification. |
编者草案 | Adds additional parameter names. |
|
OpenGL ES 2.0
The definition of 'glGet' in that specification. |
标准 | Man page of the (similar) OpenGL API. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getParameter
|
Chrome 9 | Edge 12 | Firefox 4 | IE 11 | Opera 12 | Safari 5.1 | WebView Android Yes | Chrome Android 25 | Firefox Android Yes | Opera Android 12 | Safari iOS 8 | Samsung Internet Android 1.5 |
WebGLRenderingContext
activeTexture()
attachShader()
bindAttribLocation()
bindBuffer()
bindFramebuffer()
bindRenderbuffer()
bindTexture()
blendColor()
blendEquation()
blendEquationSeparate()
blendFunc()
blendFuncSeparate()
bufferData()
bufferSubData()
checkFramebufferStatus()
clear()
clearColor()
clearDepth()
clearStencil()
colorMask()
commit()
compileShader()
compressedTexImage[23]D()
compressedTexSubImage2D()
copyTexImage2D()
copyTexSubImage2D()
createBuffer()
createFramebuffer()
createProgram()
createRenderbuffer()
createShader()
createTexture()
cullFace()
deleteBuffer()
deleteFramebuffer()
deleteProgram()
deleteRenderbuffer()
deleteShader()
deleteTexture()
depthFunc()
depthMask()
depthRange()
detachShader()
disable()
disableVertexAttribArray()
drawArrays()
drawElements()
enable()
enableVertexAttribArray()
finish()
flush()
framebufferRenderbuffer()
framebufferTexture2D()
frontFace()
generateMipmap()
getActiveAttrib()
getActiveUniform()
getAttachedShaders()
getAttribLocation()
getBufferParameter()
getContextAttributes()
getError()
getExtension()
getFramebufferAttachmentParameter()
getParameter()
getProgramInfoLog()
getProgramParameter()
getRenderbufferParameter()
getShaderInfoLog()
getShaderParameter()
getShaderPrecisionFormat()
getShaderSource()
getSupportedExtensions()
getTexParameter()
getUniform()
getUniformLocation()
getVertexAttrib()
getVertexAttribOffset()
hint()
isBuffer()
isContextLost()
isEnabled()
isFramebuffer()
isProgram()
isRenderbuffer()
isShader()
isTexture()
lineWidth()
linkProgram()
pixelStorei()
polygonOffset()
readPixels()
renderbufferStorage()
sampleCoverage()
scissor()
shaderSource()
stencilFunc()
stencilFuncSeparate()
stencilMask()
stencilMaskSeparate()
stencilOp()
stencilOpSeparate()
texImage2D()
texParameter[fi]()
texSubImage2D()
uniform[1234][fi][v]()
uniformMatrix[234]fv()
useProgram()
validateProgram()
vertexAttrib[1234]f[v]()
vertexAttribPointer()
viewport()
ANGLE_instanced_arrays
EXT_blend_minmax
EXT_color_buffer_half_float
EXT_disjoint_timer_query
EXT_frag_depth
EXT_sRGB
EXT_shader_texture_lod
EXT_texture_filter_anisotropic
OES_element_index_uint
OES_standard_derivatives
OES_texture_float
OES_texture_float_linear
OES_texture_half_float
OES_texture_half_float_linear
OES_vertex_array_object
WEBGL_color_buffer_float
WEBGL_compressed_texture_atc
WEBGL_compressed_texture_etc1
WEBGL_compressed_texture_pvrtc
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_depth_texture
WEBGL_draw_buffers
WEBGL_lose_context
WebGL2RenderingContext
WebGLActiveInfo
WebGLBuffer
WebGLContextEvent
WebGLFramebuffer
WebGLObject
WebGLProgram
WebGLQuery
WebGLRenderbuffer
WebGLSampler
WebGLShader
WebGLShaderPrecisionFormat
WebGLSync
WebGLTexture
WebGLTransformFeedback
WebGLUniformLocation
WebGLVertexArrayObject