Instead of the conversion feedback (which WebGL 1.0 does not support), you will have to use the forwarder shader and floating point texture (this requires downloading the OES_texture_float extension). This is the only way to generate vertex buffer on GPU in WebGL. WebGL also does not support pixel buffer objects, so reading the output will be very inefficient.
However, here is how you can do it:
This will be an overview of OpenGL, not something specific.
First encode the vertex array this way (add the 4th component for the index):
Vec4 pos_idx : xyz = Vertex Position, w = Vertex Index (0.0 through NumVerts-1.0)
Saving the vertex index as a component of w necessary because OpenGL ES 2.0 (WebGL 1.0) does not support gl_VertexID .
Then you need a 2D floating point texture:
MaxTexSize = Query GL_MAX_TEXTURE_SIZE Width = MaxTexSize; Height = min (NumVerts / MaxTexSize, 1);
Create an RGBA floating-point texture with these sizes and use it as an FBO embedding of color 0.
Vertex Shader:
#version 100 attribute vec4 pos_idx; uniform int width;
Passthrough Fragment Shader:
Drawing and reading:
source share