WebGL not rendering may be related to warning -
i rather new opengl , trying learn little webgl. came across a tutorial that, while great, appears bit dated. implemented own version of example in plunkr. left out square on purpose, however, once have wired not see triangle. found warning in console...
warning: attribute 0 disabled. has signficant performance penalty
and there so question seems similar looking through diff can't work , can't saying click. here drawing code reference...
drawscene() { this.gl.viewport(0, 0, this.gl.viewportwidth, this.gl.viewportheight); this.gl.clear(this.gl.color_buffer_bit | this.gl.depth_buffer_bit); mat4.perspective(45, this.gl.viewportwidth / this.gl.viewportheight, 0.1, 100.0, this.pmatrix); mat4.identity(this.mvmatrix); mat4.translate(this.mvmatrix, this.mvmatrix, [-1.5, 0.0, -7.0]); this.gl.bindbuffer(this.gl.array_buffer, this.trianglevertexpositionbuffer); this.gl.vertexattribpointer(this.shaderprogram.vertexpositionattribute, this.trianglevertexpositionbuffer.itemsize, this.gl.float, false, 0, 0); this.setmatrixuniforms(); this.gl.drawarrays(this.gl.triangles, 0, this.trianglevertexpositionbuffer.numitems); }
does have experiance here can guide newbie?
so going through this link helped lot. 1 thing consider doesn't talk glutils js file import yeah needed. seems warning message referring need in newer versions explicit params shader. here example plnkr notice different...
// needed prevent warning this.vertexpositionattribute = this.gl.getattriblocation(this.shaderprogram, "avertexposition"); this.gl.enablevertexattribarray(this.vertexpositionattribute);
when set shader attributes way avoid warning!
Comments
Post a Comment