Few remarks, by reading at the Git (not tested here, so might worth it):
- Why do you need a stencil buffer for ? A depth buffer ?
This slows things down quite a bit, and unless you actually expect Component to draw in 3 dimensions, you better leave that disabled.
- You should use VBO / PBO only when the buffer to send to the GPU is actually big enough to justify the overhead.
- I know you’ll hate me, but you need to convert your code to run on the GPU, using shaders. Ideally you should pass the list of edgetable’s side as a vertex object, and put your rasterization routine in a geometry shader. That way, you don’t send thousands of triangles to the GPU, but let the GPU do the tesselation itself. You can accumulate in a frame buffer using GL_BLEND operation, so you should be able to do anti-aliasing in the shader.
If you want to limit yourself to OpenGL ES 2.0, then you’ll need to x-plicate the number of vertex to reach the antialiasing goal you’re targeting, and skip the geometry shader stage.
So instead of:
for each path:
scan-line raster the path to create edgetable
You should probably have:
If you've geometry shaders,
Send the path curves characteristics in a buffer object, and tesselate in the GS.
-- next follow below
for each path:
figure out the number of vertex along the path with a tesselating algorithm (don't need a large resolution here). You don't need to tesselate here
in the vertex shader, tesselate and rasterize the vertex you've sent using the same algorithm (Bezier ?) as what you're doing on the CPU. Export all the modified vertex.
The output of this step is like the EdgeTable array, but in a format the GPU can understand
-- this part is common to GS/VS
In the fragment shader, you'll do the final rasterization using the vertex coming from the previous shader.
I’m not sure it’s worth transfering back the transformed VBO, but it’s an idea to test, so you only do it once per path rendering.
Using GL_BLEND allows you to actually do antialiasing with no overhead, and it’s “pixel perfect”, but you’ll divide the possible frame rate (not sure it’s an issue).
I couldn’t find where is the triangulation in the Edgetable code, so I can’t tell much more.