Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. WebGLRenderingContext
  4. getParameter()

WebGLRenderingContext: getParameter() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Note: This feature is available inWeb Workers.

TheWebGLRenderingContext.getParameter() method of theWebGL API returns a value for the passedparameter name.

Syntax

js
getParameter(pname)

Parameters

pname

AGLenum specifying which parameter value to return. See below forpossible values.

Return value

Depends on the parameter.

Parameter names

WebGL 1

You can query the followingpname parameters when using aWebGLRenderingContext.

ConstantReturned typeDescription
gl.ACTIVE_TEXTUREGLenum
gl.ALIASED_LINE_WIDTH_RANGEFloat32Array (with 2 elements)
gl.ALIASED_POINT_SIZE_RANGEFloat32Array (with 2 elements)
gl.ALPHA_BITSGLint
gl.ARRAY_BUFFER_BINDINGWebGLBuffer
gl.BLENDGLboolean
gl.BLEND_COLORFloat32Array (with 4 values)
gl.BLEND_DST_ALPHAGLenum
gl.BLEND_DST_RGBGLenum
gl.BLEND_EQUATIONGLenum
gl.BLEND_EQUATION_ALPHAGLenum
gl.BLEND_EQUATION_RGBGLenum
gl.BLEND_SRC_ALPHAGLenum
gl.BLEND_SRC_RGBGLenum
gl.BLUE_BITSGLint
gl.COLOR_CLEAR_VALUEFloat32Array (with 4 values)
gl.COLOR_WRITEMASKsequence<GLboolean> (with 4 values)
gl.COMPRESSED_TEXTURE_FORMATSUint32Array Returns the compressed texture formats.

When using theWEBGL_compressed_texture_s3tc extension:
  • ext.COMPRESSED_RGB_S3TC_DXT1_EXT
  • ext.COMPRESSED_RGBA_S3TC_DXT1_EXT
  • ext.COMPRESSED_RGBA_S3TC_DXT3_EXT
  • ext.COMPRESSED_RGBA_S3TC_DXT5_EXT

When using theWEBGL_compressed_texture_s3tc_srgb extension:

  • ext.COMPRESSED_SRGB_S3TC_DXT1_EXT
  • ext.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
  • ext.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
  • ext.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
When using theWEBGL_compressed_texture_etc extension:
  • ext.COMPRESSED_R11_EAC
  • ext.COMPRESSED_SIGNED_R11_EAC
  • ext.COMPRESSED_RG11_EAC
  • ext.COMPRESSED_SIGNED_RG11_EAC
  • ext.COMPRESSED_RGB8_ETC2
  • ext.COMPRESSED_RGBA8_ETC2_EAC
  • ext.COMPRESSED_SRGB8_ETC2
  • ext.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
  • ext.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
  • ext.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
When using theWEBGL_compressed_texture_pvrtc extension:
  • ext.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
  • ext.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
  • ext.COMPRESSED_RGB_PVRTC_2BPPV1_IMG
  • ext.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
When using theWEBGL_compressed_texture_etc1 extension:
  • ext.COMPRESSED_RGB_ETC1_WEBGL
When using theWEBGL_compressed_texture_astc extension:
  • ext.COMPRESSED_RGBA_ASTC_4x4_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
  • ext.COMPRESSED_RGBA_ASTC_5x4_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
  • ext.COMPRESSED_RGBA_ASTC_5x5_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
  • ext.COMPRESSED_RGBA_ASTC_6x5_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
  • ext.COMPRESSED_RGBA_ASTC_6x6_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
  • ext.COMPRESSED_RGBA_ASTC_8x5_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
  • ext.COMPRESSED_RGBA_ASTC_8x6_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
  • ext.COMPRESSED_RGBA_ASTC_8x8_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
  • ext.COMPRESSED_RGBA_ASTC_10x5_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
  • ext.COMPRESSED_RGBA_ASTC_10x6_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
  • ext.COMPRESSED_RGBA_ASTC_10x6_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
  • ext.COMPRESSED_RGBA_ASTC_10x10_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
  • ext.COMPRESSED_RGBA_ASTC_12x10_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
  • ext.COMPRESSED_RGBA_ASTC_12x12_KHR
  • ext.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
gl.CULL_FACEGLboolean
gl.CULL_FACE_MODEGLenumgl.FRONT,gl.BACK orgl.FRONT_AND_BACK. See alsocullFace
gl.CURRENT_PROGRAMWebGLProgram ornull SeeuseProgram.
gl.DEPTH_BITSGLint
gl.DEPTH_CLEAR_VALUEGLfloat
gl.DEPTH_FUNCGLenum
gl.DEPTH_RANGEFloat32Array (with 2 elements)
gl.DEPTH_TESTGLboolean
gl.DEPTH_WRITEMASKGLboolean
gl.DITHERGLboolean
gl.ELEMENT_ARRAY_BUFFER_BINDINGWebGLBuffer
gl.FRAMEBUFFER_BINDINGWebGLFramebuffer ornullnull corresponds to a binding to the default framebuffer. See alsobindFramebuffer.
gl.FRONT_FACEGLenumgl.CW orgl.CCW. See alsofrontFace.
gl.GENERATE_MIPMAP_HINTGLenumgl.FASTEST,gl.NICEST orgl.DONT_CARE. See alsohint.
gl.GREEN_BITSGLint
gl.IMPLEMENTATION_COLOR_READ_FORMATGLenum
gl.IMPLEMENTATION_COLOR_READ_TYPEGLenum
gl.LINE_WIDTHGLfloat
gl.MAX_COMBINED_TEXTURE_IMAGE_UNITSGLint
gl.MAX_CUBE_MAP_TEXTURE_SIZEGLint
gl.MAX_FRAGMENT_UNIFORM_VECTORSGLint
gl.MAX_RENDERBUFFER_SIZEGLint
gl.MAX_TEXTURE_IMAGE_UNITSGLint
gl.MAX_TEXTURE_SIZEGLint
gl.MAX_VARYING_VECTORSGLint
gl.MAX_VERTEX_ATTRIBSGLint
gl.MAX_VERTEX_TEXTURE_IMAGE_UNITSGLint
gl.MAX_VERTEX_UNIFORM_VECTORSGLint
gl.MAX_VIEWPORT_DIMSInt32Array (with 2 elements)
gl.PACK_ALIGNMENTGLint
gl.POLYGON_OFFSET_FACTORGLfloat
gl.POLYGON_OFFSET_FILLGLboolean
gl.POLYGON_OFFSET_UNITSGLfloat
gl.RED_BITSGLint
gl.RENDERBUFFER_BINDINGWebGLRenderbuffer ornull SeebindRenderbuffer.
gl.RENDERERstring
gl.SAMPLE_BUFFERSGLint
gl.SAMPLE_COVERAGE_INVERTGLboolean
gl.SAMPLE_COVERAGE_VALUEGLfloat
gl.SAMPLESGLint
gl.SCISSOR_BOXInt32Array (with 4 elements)
gl.SCISSOR_TESTGLboolean
gl.SHADING_LANGUAGE_VERSIONstring
gl.STENCIL_BACK_FAILGLenum
gl.STENCIL_BACK_FUNCGLenum
gl.STENCIL_BACK_PASS_DEPTH_FAILGLenum
gl.STENCIL_BACK_PASS_DEPTH_PASSGLenum
gl.STENCIL_BACK_REFGLint
gl.STENCIL_BACK_VALUE_MASKGLuint
gl.STENCIL_BACK_WRITEMASKGLuint
gl.STENCIL_BITSGLint
gl.STENCIL_CLEAR_VALUEGLint
gl.STENCIL_FAILGLenum
gl.STENCIL_FUNCGLenum
gl.STENCIL_PASS_DEPTH_FAILGLenum
gl.STENCIL_PASS_DEPTH_PASSGLenum
gl.STENCIL_REFGLint
gl.STENCIL_TESTGLboolean
gl.STENCIL_VALUE_MASKGLuint
gl.STENCIL_WRITEMASKGLuint
gl.SUBPIXEL_BITSGLint
gl.TEXTURE_BINDING_2DWebGLTexture ornull
gl.TEXTURE_BINDING_CUBE_MAPWebGLTexture ornull
gl.UNPACK_ALIGNMENTGLint
gl.UNPACK_COLORSPACE_CONVERSION_WEBGLGLenum
gl.UNPACK_FLIP_Y_WEBGLGLboolean
gl.UNPACK_PREMULTIPLY_ALPHA_WEBGLGLboolean
gl.VENDORstring
gl.VERSIONstring
gl.VIEWPORTInt32Array (with 4 elements)

WebGL 2

You can query the followingpname parameters when using aWebGL2RenderingContext.

ConstantReturned typeDescription
gl.COPY_READ_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.COPY_WRITE_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.DRAW_BUFFERiGLenumgl.BACK,gl.NONE orgl.COLOR_ATTACHMENT{0-15}. See alsodrawBuffers.
gl.DRAW_FRAMEBUFFER_BINDINGWebGLFramebuffer ornullnull corresponds to a binding to the default framebuffer. See alsobindFramebuffer.
gl.FRAGMENT_SHADER_DERIVATIVE_HINTGLenumgl.FASTEST,gl.NICEST orgl.DONT_CARE. See alsohint.
gl.MAX_3D_TEXTURE_SIZEGLint
gl.MAX_ARRAY_TEXTURE_LAYERSGLint
gl.MAX_CLIENT_WAIT_TIMEOUT_WEBGLGLint64
gl.MAX_COLOR_ATTACHMENTSGLint
gl.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTSGLint64
gl.MAX_COMBINED_UNIFORM_BLOCKSGLint
gl.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTSGLint64
gl.MAX_DRAW_BUFFERSGLint
gl.MAX_ELEMENT_INDEXGLint64
gl.MAX_ELEMENTS_INDICESGLint
gl.MAX_ELEMENTS_VERTICESGLint
gl.MAX_FRAGMENT_INPUT_COMPONENTSGLint
gl.MAX_FRAGMENT_UNIFORM_BLOCKSGLint
gl.MAX_FRAGMENT_UNIFORM_COMPONENTSGLint
gl.MAX_PROGRAM_TEXEL_OFFSETGLint
gl.MAX_SAMPLESGLint
gl.MAX_SERVER_WAIT_TIMEOUTGLint64
gl.MAX_TEXTURE_LOD_BIASGLfloat
gl.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTSGLint
gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBSGLint
gl.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTSGLint
gl.MAX_UNIFORM_BLOCK_SIZEGLint64
gl.MAX_UNIFORM_BUFFER_BINDINGSGLint
gl.MAX_VARYING_COMPONENTSGLint
gl.MAX_VERTEX_OUTPUT_COMPONENTSGLint
gl.MAX_VERTEX_UNIFORM_BLOCKSGLint
gl.MAX_VERTEX_UNIFORM_COMPONENTSGLint
gl.MIN_PROGRAM_TEXEL_OFFSETGLint
gl.PACK_ROW_LENGTHGLint SeepixelStorei.
gl.PACK_SKIP_PIXELSGLint SeepixelStorei.
gl.PACK_SKIP_ROWSGLint SeepixelStorei.
gl.PIXEL_PACK_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.PIXEL_UNPACK_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.RASTERIZER_DISCARDGLboolean
gl.READ_BUFFERGLenum
gl.READ_FRAMEBUFFER_BINDINGWebGLFramebuffer ornullnull corresponds to a binding to the default framebuffer. See alsobindFramebuffer.
gl.SAMPLE_ALPHA_TO_COVERAGEGLboolean
gl.SAMPLE_COVERAGEGLboolean
gl.SAMPLER_BINDINGWebGLSampler ornull SeebindSampler.
gl.TEXTURE_BINDING_2D_ARRAYWebGLTexture ornull SeebindTexture.
gl.TEXTURE_BINDING_3DWebGLTexture ornull SeebindTexture.
gl.TRANSFORM_FEEDBACK_ACTIVEGLboolean
gl.TRANSFORM_FEEDBACK_BINDINGWebGLTransformFeedback ornull SeebindTransformFeedback.
gl.TRANSFORM_FEEDBACK_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.TRANSFORM_FEEDBACK_PAUSEDGLboolean
gl.UNIFORM_BUFFER_BINDINGWebGLBuffer ornull SeebindBuffer.
gl.UNIFORM_BUFFER_OFFSET_ALIGNMENTGLint SeepixelStorei.
gl.UNPACK_IMAGE_HEIGHTGLint SeepixelStorei.
gl.UNPACK_ROW_LENGTHGLint SeepixelStorei.
gl.UNPACK_SKIP_IMAGESGLint SeepixelStorei.
gl.UNPACK_SKIP_PIXELSGLint SeepixelStorei.
gl.UNPACK_SKIP_ROWSGLint SeepixelStorei.
gl.VERTEX_ARRAY_BINDINGWebGLVertexArrayObject ornull SeebindVertexArray.

WebGL extensions

You can query the followingpname parameters when usingWebGL extensions:

ConstantReturned typeExtensionDescription
ext.MAX_TEXTURE_MAX_ANISOTROPY_EXTGLfloatEXT_texture_filter_anisotropicMaximum available anisotropy.
ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OESGLenumOES_standard_derivatives Accuracy of the derivative calculation for the GLSL built-in functions:dFdx,dFdy, andfwidth.
ext.MAX_COLOR_ATTACHMENTS_WEBGLGLintWEBGL_draw_buffersThe maximum number of framebuffer color attachment points.
ext.MAX_DRAW_BUFFERS_WEBGLGLintWEBGL_draw_buffersThe maximum number of draw buffers.
ext.DRAW_BUFFER0_WEBGL
ext.DRAW_BUFFER1_WEBGL
ext.DRAW_BUFFER2_WEBGL
ext.DRAW_BUFFER3_WEBGL
ext.DRAW_BUFFER4_WEBGL
ext.DRAW_BUFFER5_WEBGL
ext.DRAW_BUFFER6_WEBGL
ext.DRAW_BUFFER7_WEBGL
ext.DRAW_BUFFER8_WEBGL
ext.DRAW_BUFFER9_WEBGL
ext.DRAW_BUFFER10_WEBGL
ext.DRAW_BUFFER11_WEBGL
ext.DRAW_BUFFER12_WEBGL
ext.DRAW_BUFFER13_WEBGL
ext.DRAW_BUFFER14_WEBGL
ext.DRAW_BUFFER15_WEBGL
GLenumWEBGL_draw_buffersDrawing buffers.
ext.VERTEX_ARRAY_BINDING_OESWebGLVertexArrayObjectOESOES_vertex_array_objectBound vertex array object (VAO).
ext.TIMESTAMP_EXTGLuint64EXTEXT_disjoint_timer_queryThe current time.
ext.GPU_DISJOINT_EXTGLbooleanEXT_disjoint_timer_query

Returns whether or not the GPU performed any disjoint operation.

ext.MAX_VIEWS_OVRGLintOVR_multiview2Maximum number of views.

Examples

js
gl.getParameter(gl.DITHER);gl.getParameter(gl.VERSION);gl.getParameter(gl.VIEWPORT);

Specifications

Specification
WebGL Specification
# 5.14.3
WebGL 2.0 Specification
# 3.7.2

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp