WebGL2RenderingContext - Web APIs | MDN

文章推薦指數: 80 %
投票人數:10人

To get an object of this interface, call getContext() on a ... context can accept additional values when used in a WebGL 2 context. SkiptomaincontentSkiptosearchSkiptoselectlanguageReferencesWebAPIsWebGL2RenderingContextArticleActionsEnglish(US)ConstantsStateinformationBuffersFramebuffersRenderbuffersTexturesProgramsandshadersUniformsandattributesDrawingbuffersQueryobjectsSamplerobjectsSyncobjectsTransformfeedbackUniformbufferobjectsVertexarrayobjectsSpecificationsBrowsercompatibilitySeealsoRelatedTopicsWebGLAPIWebGL2RenderingContextMethodsbeginQuery()beginTransformFeedback()bindBufferBase()bindBufferRange()bindSampler()bindTransformFeedback()bindVertexArray()blitFramebuffer()clearBuffer[fiuv]()clientWaitSync()compressedTexSubImage3D()copyBufferSubData()copyTexSubImage3D()createQuery()createSampler()createTransformFeedback()createVertexArray()deleteQuery()deleteSampler()deleteSync()deleteTransformFeedback()deleteVertexArray()drawArraysInstanced()drawBuffers()drawElementsInstanced()drawRangeElements()endQuery()endTransformFeedback()fenceSync()framebufferTextureLayer()getActiveUniformBlockName()getActiveUniformBlockParameter()getActiveUniforms()getBufferSubData()getFragDataLocation()getIndexedParameter()getInternalformatParameter()getQuery()getQueryParameter()getSamplerParameter()getSyncParameter()getTransformFeedbackVarying()getUniformBlockIndex()getUniformIndices()invalidateFramebuffer()invalidateSubFramebuffer()isQuery()isSampler()isSync()isTransformFeedback()isVertexArray()pauseTransformFeedback()readBuffer()renderbufferStorageMultisample()resumeTransformFeedback()samplerParameter[if]()texImage3D()texStorage2D()texStorage3D()texSubImage3D()transformFeedbackVaryings()uniform[1234][uif][v]()uniformBlockBinding()uniformMatrix[234]x[234]fv()vertexAttribDivisor()vertexAttribI4[u]i[v]()vertexAttribIPointer()waitSync()RelatedpagesforWebGLANGLE_instanced_arraysEXT_blend_minmaxEXT_color_buffer_half_floatEXT_disjoint_timer_queryEXT_frag_depthEXT_sRGBEXT_shader_texture_lodEXT_texture_filter_anisotropicOES_element_index_uintOES_standard_derivativesOES_texture_floatOES_texture_float_linearOES_texture_half_floatOES_texture_half_float_linearOES_vertex_array_objectWEBGL_color_buffer_floatWEBGL_compressed_texture_etc1WEBGL_compressed_texture_pvrtcWEBGL_compressed_texture_s3tcWEBGL_compressed_texture_s3tc_srgbWEBGL_debug_renderer_infoWEBGL_debug_shadersWEBGL_depth_textureWEBGL_draw_buffersWEBGL_lose_contextWebGLActiveInfoWebGLBufferWebGLContextEventWebGLFramebufferWebGLObjectWebGLProgramWebGLQueryWebGLRenderbufferWebGLRenderingContextWebGLSamplerWebGLShaderWebGLShaderPrecisionFormatWebGLSyncWebGLTextureWebGLTransformFeedbackWebGLUniformLocationWebGLVertexArrayObjectConstantsStateinformationBuffersFramebuffersRenderbuffersTexturesProgramsandshadersUniformsandattributesDrawingbuffersQueryobjectsSamplerobjectsSyncobjectsTransformfeedbackUniformbufferobjectsVertexarrayobjectsSpecificationsBrowsercompatibilitySeealsoWebGL2RenderingContextTheWebGL2RenderingContextinterfaceprovidestheOpenGLES3.0renderingcontextforthedrawingsurfaceofanHTMLelement. Togetanobjectofthisinterface,callgetContext()onaelement,supplying"webgl2"astheargument: varcanvas=document.getElementById('myCanvas'); vargl=canvas.getContext('webgl2'); Note:WebGL2isanextensiontoWebGL1.TheWebGL2RenderingContextinterfaceimplementsallmembersoftheWebGLRenderingContextinterface.SomemethodsoftheWebGL1contextcanacceptadditionalvalueswhenusedinaWebGL2context.YouwillfindthisinfonotedontheWebGL1referencepages. TheWebGLtutorialhasmoreinformation,examples,andresourcesonhowtogetstartedwithWebGL.ConstantsSeetheWebGLconstantspage.Stateinformation WebGL2RenderingContext.getIndexedParameter() Returnstheindexedvalueforthegiventarget. Buffers WebGL2RenderingContext.bufferData() Initializesandcreatesthebufferobject'sdatastore. WebGL2RenderingContext.bufferSubData() Updatesasubsetofabufferobject'sdatastore. WebGL2RenderingContext.copyBufferSubData() Copiespartofthedataofabuffertoanotherbuffer. WebGL2RenderingContext.getBufferSubData() ReadsdatafromabufferandwritesthemtoanArrayBufferorSharedArrayBuffer. Framebuffers WebGL2RenderingContext.blitFramebuffer() Transfersablockofpixelsfromthereadframebuffertothedrawframebuffer. WebGL2RenderingContext.framebufferTextureLayer() Attachesasinglelayerofatexturetoaframebuffer. WebGL2RenderingContext.invalidateFramebuffer() Invalidatesthecontentsofattachmentsinaframebuffer. WebGL2RenderingContext.invalidateSubFramebuffer() Invalidatesportionsofthecontentsofattachmentsinaframebuffer WebGL2RenderingContext.readBuffer() Selectsacolorbufferasthesourceforpixels. Renderbuffers WebGL2RenderingContext.getInternalformatParameter() Returnsinformationaboutimplementation-dependentsupportforinternalformats. WebGL2RenderingContext.renderbufferStorageMultisample() Createsandinitializesarenderbufferobject'sdatastoreandallowsspecifyingthenumberofsamplestobeused. Textures WebGL2RenderingContext.texStorage2D() Specifiesalllevelsoftwo-dimensionaltexturestorage. WebGL2RenderingContext.texStorage3D() Specifiesalllevelsofathree-dimensionaltextureortwo-dimensionalarraytexture. WebGL2RenderingContext.texImage3D() Specifiesathree-dimensionaltextureimage. WebGL2RenderingContext.texSubImage3D() Specifiesasub-rectangleofthecurrent3Dtexture. WebGL2RenderingContext.copyTexSubImage3D() CopiespixelsfromthecurrentWebGLFramebufferintoanexisting3Dtexturesub-image. WebGL2RenderingContext.compressedTexImage3D() Specifiesathree-dimensionaltextureimageinacompressedformat. WebGL2RenderingContext.compressedTexSubImage3D() Specifiesathree-dimensionalsub-rectangleforatextureimageinacompressedformat. Programsandshaders WebGL2RenderingContext.getFragDataLocation() Returnsthebindingofcolornumberstouser-definedvaryingoutvariables. Uniformsandattributes WebGL2RenderingContext.uniform[1234][uif][v]() Methodsspecifyingvaluesofuniformvariables. WebGL2RenderingContext.uniformMatrix[234]x[234]fv() Methodsspecifyingmatrixvaluesforuniformvariables. WebGL2RenderingContext.vertexAttribI4[u]i[v]() Methodsspecifyingintegervaluesforgenericvertexattributes. WebGL2RenderingContext.vertexAttribIPointer() Specifiesintegerdataformatsandlocationsofvertexattributesinavertexattributesarray. Drawingbuffers WebGL2RenderingContext.vertexAttribDivisor() Modifiestherateatwhichgenericvertexattributesadvancewhenrenderingmultipleinstancesofprimitiveswithgl.drawArraysInstanced()andgl.drawElementsInstanced(). WebGL2RenderingContext.drawArraysInstanced() Rendersprimitivesfromarraydata.Inaddition,itcanexecutemultipleinstancesoftherangeofelements. WebGL2RenderingContext.drawElementsInstanced() Rendersprimitivesfromarraydata.Inaddition,itcanexecutemultipleinstancesofasetofelements. WebGL2RenderingContext.drawRangeElements() Rendersprimitivesfromarraydatainagivenrange. WebGL2RenderingContext.drawBuffers() Specifiesalistofcolorbufferstobedrawninto. WebGL2RenderingContext.clearBuffer[fiuv]() Clearsbuffersfromthecurrentlyboundframebuffer. QueryobjectsMethodsforworkingwithWebGLQueryobjects. WebGL2RenderingContext.createQuery() CreatesanewWebGLQueryobject. WebGL2RenderingContext.deleteQuery() DeletesagivenWebGLQueryobject. WebGL2RenderingContext.isQuery() ReturnstrueifagivenobjectisavalidWebGLQueryobject. WebGL2RenderingContext.beginQuery() Beginsanasynchronousquery. WebGL2RenderingContext.endQuery() Markstheendofanasynchronousquery. WebGL2RenderingContext.getQuery() ReturnsaWebGLQueryobjectforagiventarget. WebGL2RenderingContext.getQueryParameter() Returnsinformationaboutaquery. Samplerobjects WebGL2RenderingContext.createSampler() CreatesanewWebGLSamplerobject. WebGL2RenderingContext.deleteSampler() DeletesagivenWebGLSamplerobject. WebGL2RenderingContext.bindSampler() BindsagivenWebGLSamplertoatextureunit. WebGL2RenderingContext.isSampler() ReturnstrueifagivenobjectisavalidWebGLSamplerobject. WebGL2RenderingContext.samplerParameter[if]() Setssamplerparameters. WebGL2RenderingContext.getSamplerParameter() Returnssamplerparameterinformation. Syncobjects WebGL2RenderingContext.fenceSync() CreatesanewWebGLSyncobjectandinsertsitintotheGLcommandstream. WebGL2RenderingContext.isSync() ReturnstrueifthepassedobjectisavalidWebGLSyncobject. WebGL2RenderingContext.deleteSync() DeletesagivenWebGLSyncobject. WebGL2RenderingContext.clientWaitSync() BlocksandwaitsforaWebGLSyncobjecttobecomesignaledoragiventimeouttobepassed. WebGL2RenderingContext.waitSync() Returnsimmediately,butwaitsontheGLserveruntilthegivenWebGLSyncobjectissignaled. WebGL2RenderingContext.getSyncParameter() ReturnsparameterinformationofaWebGLSyncobject. Transformfeedback WebGL2RenderingContext.createTransformFeedback() CreatesandinitializesWebGLTransformFeedbackobjects. WebGL2RenderingContext.deleteTransformFeedback() DeletesagivenWebGLTransformFeedbackobject. WebGL2RenderingContext.isTransformFeedback() ReturnstrueifthepassedobjectisavalidWebGLTransformFeedbackobject. WebGL2RenderingContext.bindTransformFeedback() BindsapassedWebGLTransformFeedbackobjecttothecurrentGLstate. WebGL2RenderingContext.beginTransformFeedback() Startsatransformfeedbackoperation. WebGL2RenderingContext.endTransformFeedback() Endsatransformfeedbackoperation. WebGL2RenderingContext.transformFeedbackVaryings() SpecifiesvaluestorecordinWebGLTransformFeedbackbuffers. WebGL2RenderingContext.getTransformFeedbackVarying() ReturnsinformationaboutvaryingvariablesfromWebGLTransformFeedbackbuffers. WebGL2RenderingContext.pauseTransformFeedback() Pausesatransformfeedbackoperation. WebGL2RenderingContext.resumeTransformFeedback() Resumesatransformfeedbackoperation. Uniformbufferobjects WebGL2RenderingContext.bindBufferBase() BindsagivenWebGLBuffertoagivenbindingpoint(target)atagivenindex. WebGL2RenderingContext.bindBufferRange() BindsarangeofagivenWebGLBuffertoagivenbindingpoint(target)atagivenindex. WebGL2RenderingContext.getUniformIndices() RetrievestheindicesofanumberofuniformswithinaWebGLProgram. WebGL2RenderingContext.getActiveUniforms() RetrievesinformationaboutactiveuniformswithinaWebGLProgram. WebGL2RenderingContext.getUniformBlockIndex() RetrievestheindexofauniformblockwithinaWebGLProgram. WebGL2RenderingContext.getActiveUniformBlockParameter() RetrievesinformationaboutanactiveuniformblockwithinaWebGLProgram. WebGL2RenderingContext.getActiveUniformBlockName() RetrievesthenameoftheactiveuniformblockatagivenindexwithinaWebGLProgram. WebGL2RenderingContext.uniformBlockBinding() Assignsbindingpointsforactiveuniformblocks. VertexarrayobjectsMethodsforworkingwithWebGLVertexArrayObject(VAO)objects. WebGL2RenderingContext.createVertexArray() CreatesanewWebGLVertexArrayObject. WebGL2RenderingContext.deleteVertexArray() DeletesagivenWebGLVertexArrayObject. WebGL2RenderingContext.isVertexArray() ReturnstrueifagivenobjectisavalidWebGLVertexArrayObject. WebGL2RenderingContext.bindVertexArray() BindsagivenWebGLVertexArrayObjecttothebuffer. SpecificationsSpecificationWebGL2.0Specification#3.7BrowsercompatibilityBCDtablesonlyloadinthebrowserSeealso HTMLCanvasElement WebGLRenderingContext Foundaproblemwiththispage?EditonGitHubSourceonGitHubReportaproblemwiththiscontentonGitHubWanttofixtheproblemyourself?SeeourContributionguide.Lastmodified:Jan20,2022,byMDNcontributors



請為這篇文章評分?