WebGL does not support rendering without a VBO, see https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.2 . There is an emulation layer that you can use to add support for that by specifying the -s FULL_ES2=1 linker flag, but that comes with a considerable performance cost, emulation of client-side arrays is not cheap. For best performance, adjusting the code to use VBOs would be best.
2014-08-12 9:56 GMT+03:00 Sergey Solozhentsev <[email protected]> : > I'm trying to convert Opengl ES code to javascript. I have strange error > Error: WebGL: vertexAttribPointer: must have valid GL_ARRAY_BUFFER binding > Error: WebGL: drawElements: must have element array buffer binding > > Does it mean that I must use VBO for drawing? > I use following code for drawing > > glVertexAttribPointer(textCoordAttrib, 2, GL_FLOAT, > GL_FALSE, sizeof(Vertex), &batch.vertices[0].textureCoordinates); > glVertexAttribPointer(colorAttrib, 4, GL_UNSIGNED_BYTE, GL_TRUE, > sizeof(Vertex), > &batch.vertices[0].color); > glVertexAttribPointer(vertexAttrib, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), > &batch.vertices[0].position); > glDrawElements(GL_TRIANGLE_STRIP, batch.indeces.size(), GL_UNSIGNED_SHORT, > & batch.indeces[0]); > > without any VBO. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
