WebGLRenderingContext.getAttribLocation - Javascript

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

getAttribLocation( program, name ) const buffer = gl.createBuffer() gl.bindBuffer( gl.ARRAY_BUFFER, buffer ) gl.enableVertexAttribArray( index ) gl. HowtousegetAttribLocationfunctioninWebGLRenderingContextBestJavaScriptcodesnippetsusingbuiltins.WebGLRenderingContext.getAttribLocation(Showingtop3resultsoutof315)createBuffer(name,size){ constgl=this.gl constprogram=this.program constindex=gl.getAttribLocation(program,name) constbuffer=gl.createBuffer() gl.bindBuffer(gl.ARRAY_BUFFER,buffer) gl.enableVertexAttribArray(index) gl.vertexAttribPointer(index,size,gl.FLOAT,false,0,0) returnbuffer } /** *Extractstheattributes *@class *@memberofPIXI.glCore.shader *@paramgl{WebGLRenderingContext}ThecurrentWebGLrenderingcontext *@paramprogram{WebGLProgram}Theshaderprogramtogettheattributesfrom *@returnattributes{Object} */ varextractAttributes=function(gl,program) { varattributes={}; vartotalAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES); for(vari=0;i



請為這篇文章評分?