WebGLRenderingContext.bindFramebuffer() - Web APIs | MDN
文章推薦指數: 80 %
Binding a frame buffer. var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var framebuffer = gl. SkiptomaincontentSkiptosearchSkiptoselectlanguageReferencesWebAPIsWebGLRenderingContextWebGLRenderingContext.bindFramebuffer()ArticleActionsEnglish(US)SyntaxExamplesSpecificationsBrowsercompatibilitySeealsoRelatedTopicsWebGLAPIWebGLRenderingContextPropertiescanvasdrawingBufferHeightdrawingBufferWidthMethodsactiveTexture()attachShader()bindAttribLocation()bindBuffer()bindFramebuffer()bindRenderbuffer()bindTexture()blendColor()blendEquation()blendEquationSeparate()blendFunc()blendFuncSeparate()bufferData()bufferSubData()checkFramebufferStatus()clear()clearColor()clearDepth()clearStencil()colorMask() Experimental 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()makeXRCompatible()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()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_contextWebGL2RenderingContextWebGLActiveInfoWebGLBufferWebGLContextEventWebGLFramebufferWebGLObjectWebGLProgramWebGLQueryWebGLRenderbufferWebGLSamplerWebGLShaderWebGLShaderPrecisionFormatWebGLSyncWebGLTextureWebGLTransformFeedbackWebGLUniformLocationWebGLVertexArrayObjectSyntaxExamplesSpecificationsBrowsercompatibilitySeealsoWebGLRenderingContext.bindFramebuffer() TheWebGLRenderingContext.bindFramebuffer()methodofthe WebGLAPIbindsagiven WebGLFramebuffertoatarget. SyntaxbindFramebuffer(target,framebuffer) Parameters target AGLenumspecifyingthebindingpoint(target).Possiblevalues: gl.FRAMEBUFFER Collectionbufferdatastorageofcolor,alpha, depthandstencilbuffersusedasbothadestinationfordrawingandasasourceforreading(seebelow). WhenusingaWebGL2context, thefollowingvaluesareavailableadditionally: gl.DRAW_FRAMEBUFFER Usedasadestinationfordrawingoperationssuchasgl.draw*,gl.clear*andgl.blitFramebuffer. gl.READ_FRAMEBUFFER Usedasasourceforreadingoperationssuchasgl.readPixelsandgl.blitFramebuffer. framebuffer AWebGLFramebufferobjecttobind. Ifframebufferisnull,thenthecanvas(whichhasnoWebGLFramebufferobject)isbound. ReturnvalueNone(undefined).Exceptions Agl.INVALID_ENUMerroristhrowniftargetisnot gl.FRAMEBUFFER,gl.DRAW_FRAMEBUFFER,or gl.READ_FRAMEBUFFER. ExamplesBindingaframebuffervarcanvas=document.getElementById('canvas'); vargl=canvas.getContext('webgl'); varframebuffer=gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER,framebuffer); Gettingcurrentbindings Tocheckthecurrentframebufferbinding,querytheFRAMEBUFFER_BINDING constant. gl.getParameter(gl.FRAMEBUFFER_BINDING); SpecificationsSpecificationWebGLSpecification#5.14.6WebGL2.0Specification#3.7.1BrowsercompatibilityBCDtablesonlyloadinthebrowserSeealso WebGLRenderingContext.createFramebuffer() WebGLRenderingContext.deleteFramebuffer() WebGLRenderingContext.isFramebuffer() Otherbuffers:WebGLBuffer,WebGLRenderbuffer Foundaproblemwiththispage?EditonGitHubSourceonGitHubReportaproblemwiththiscontentonGitHubWanttofixtheproblemyourself?SeeourContributionguide.Lastmodified:May20,2022,byMDNcontributors
延伸文章資訊
- 1WebGL中图片多级处理(FrameBuffer) - 纸异兽- 博客园
FBO(Frame Buffer Object)是被推荐用于将数据渲染到纹理对象的扩展。 FrameBuffer就像是一个webgl显示容器一样,平时我们使用gl.drawArrays或者gl.
- 2WebGL Framebuffers
This article is meant to try to give you a mental image of what a framebuffer is in WebGL. Frameb...
- 3How to work with framebuffers in webgl? - Stack Overflow
A fragment shader outputs to either the canvas or the attachments in a framebuffer. To be more te...
- 4JavaScript WebGL framebuffer object - SegmentFault 思否
When How I built a wind map with WebGL , framebuffer was used in it, so I checked the data and tr...
- 5一起幫忙解決難題,拯救IT 人的一天
Framebuffer. 如何在網頁中繪製3D 場景?從WebGL 的基礎開始說起系列第22 篇. PastLeo. 7 個月前‧ 283 瀏覽. 0. 大家好,我是西瓜,你現在看到的是2021...