WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
文章推薦指數: 80 %
const a_foobar = gl.getAttribLocation(shaderProgram, 'foobar'); //either set each component individually: gl.vertexAttrib3f(a_foobar, 10.0 ... SkiptomaincontentSkiptosearchSkiptoselectlanguageReferencesWebAPIsWebGLRenderingContextWebGLRenderingContext.vertexAttrib[1234]f[v]()ArticleActionsEnglish(US)SyntaxDescriptionExamplesSpecificationsBrowsercompatibilitySeealsoRelatedTopicsWebGLAPIWebGLRenderingContextPropertiescanvasdrawingBufferHeightdrawingBufferWidthMethodsactiveTexture()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_contextWebGL2RenderingContextWebGLActiveInfoWebGLBufferWebGLContextEventWebGLFramebufferWebGLObjectWebGLProgramWebGLQueryWebGLRenderbufferWebGLSamplerWebGLShaderWebGLShaderPrecisionFormatWebGLSyncWebGLTextureWebGLTransformFeedbackWebGLUniformLocationWebGLVertexArrayObjectSyntaxDescriptionExamplesSpecificationsBrowsercompatibilitySeealsoWebGLRenderingContext.vertexAttrib[1234]f[v]() TheWebGLRenderingContext.vertexAttrib[1234]f[v]() methodsoftheWebGLAPIspecifyconstant valuesforgenericvertexattributes. SyntaxvertexAttrib1f(index,v0) vertexAttrib2f(index,v0,v1) vertexAttrib3f(index,v0,v1,v2) vertexAttrib4f(index,v0,v1,v2,v3) vertexAttrib1fv(index,value) vertexAttrib2fv(index,value) vertexAttrib3fv(index,value) vertexAttrib4fv(index,value) Parameters index AGLuintspecifyingthepositionofthevertexattributetobe modified. v0,v1,v2,v3 AfloatingpointNumberforthevertexattributevalue. value AFloat32Arrayforfloatingpointvectorvertexattributevalues. ReturnvalueNone(undefined).Description Whilevertexattributesareusuallyusedtospecifyvalueswhicharedifferentforeach vertex(usingvertexAttribPointer),itcanbeusefultospecifyaconstantvalue.Forexample,if youhaveashaderwhichhasacolorvertexattribute,butyouwanttodraw everythinginasinglecolor,youcanusevertexAttribtoachievethat withoutcreatingabufferfilledwithonlyonevalueorhavingtocreateaseparate shaderwhichusesauniformforthecolor. Thisvaluewillbeusedifaboundarraybufferhasnotbeenenabledwith enableVertexAttribArray. Attributesmaybematrices,inwhichcasecolumnsofthematrixmustbeloadedinto successivevertexattributeslots. ThevaluessetwithvertexAttribPointerarecontext-global,i.e.theyaren'tpartoftheshaderstate (likegenerixvertexattributeindexestoshadervariablebindings)andaren'tpartof thevertexarrayobjectstate(likeenabledvertexattributearrays).Theonlywayto changethevaluesisbycallingthisfunctionagain. Examplesconsta_foobar=gl.getAttribLocation(shaderProgram,'foobar'); //eitherseteachcomponentindividually: gl.vertexAttrib3f(a_foobar,10.0,5.0,2.0); //orprovideaFloat32Array: constfloatArray=newFloat32Array([10.0,5.0,2.0]); gl.vertexAttrib3fv(a_foobar,floatArray); //wewanttoloadthefollowing3x3matrixintoattributenamed"matrix3x3" //012 //345 //678 constmatrix3x3Location=gl.getAttribLocation(shaderProgram,'matrix3x3'); gl.vertexAttrib3f(matrix3x3Location,0,3,6); gl.vertexAttrib3f(matrix3x3Location+1,1,4,7); gl.vertexAttrib3f(matrix3x3Location+2,2,5,8); SpecificationsSpecificationWebGLSpecification#5.14.10BrowsercompatibilityBCDtablesonlyloadinthebrowserSeealso WebGLRenderingContext.getVertexAttrib() Foundaproblemwiththispage?EditonGitHubSourceonGitHubReportaproblemwiththiscontentonGitHubWanttofixtheproblemyourself?SeeourContributionguide.Lastmodified:Jun3,2022,byMDNcontributors
延伸文章資訊
- 1gl::VertexAttrib3f - Rust - Docs.rs
API documentation for the Rust `VertexAttrib3f` mod in crate `gl`.
- 2在JavaScript程序通过attribute变量向顶点着色器传值 - CSDN博客
gl.vertexAttrib3f() 方法是一系列同族函数中的一个,该系列函数的任务就是从JavaScript程序中向顶点着色器中的attribute变量传值
- 3egaku2d_core::gl::VertexAttrib3f - Rust - Docs.rs
API documentation for the Rust `VertexAttrib3f` mod in crate `egaku2d_core`. ... [−][src]Module e...
- 4WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
const a_foobar = gl.getAttribLocation(shaderProgram, 'foobar'); //either set each component indiv...
- 5Gl.VertexAttrib3f (gb.opengl.glsl) - / - Gambas Documentation
Gl.VertexAttrib3f (gb.opengl.glsl) ... Specifies the value of a generic vertex attribute. Paramet...