art with code

2009-03-08

Canvas 3D tests update

On the canvas3d-tests front, added VBO tests for drawArrays (and fixed some drawArrays tests), wrote some GLSL compile tests and tomorrow I get to see if they hang or crash my video card.

Also wrote bounds-checking for drawArrays and vertexAttribPointer with buffer index param. And vlad posted his updates, so I get to try and integrate them into my tree. His drawArrays/drawElements bounds-checking is more elegant than mine, so that's good. And I see that he's now using CGL instead of AGL on Apple, plus blending the drawing area using OpenGL on CGL, which should be nice and fast.

Benchmarked the GLX swapBuffers implementation that does glReadPixels+premultiply. Using a 1000x1000 canvas, swapBuffers takes 8 ms, of which 5.5 ms is glReadPixels and 2.5 ms premultiply (using SSE2, which is ~2x faster than the normal version.) And that doesn't include the time it takes to blend the canvas to the document, which likely adds at least 2 ms on top of the 8 ms. So the overhead for the glReadPixels+premultiply -approach is around 10 ms per frame. Which makes 60fps a bit challenging.

Doing the premultiply and blend using OpenGL (by maintaining a cached texture copy of the area below) could bring the overhead down to the 5.5 ms used by glReadPixels. Or if you can do that, you could also maintain a cached texture of the area above as well and use the GL context for doing the compositing and rendering for the canvas area, and get rid of the glReadPixels call altogether (though it does sound like something that would make you lose all your hair.)
Post a Comment

Blog Archive

About Me

My photo

Built art installations, web sites, graphics libraries, web browsers, mobile apps, desktop apps, media player themes, many nutty prototypes, much bad code, much bad art.

Have freelanced for Verizon, Google, Mozilla, Warner Bros, Sony Pictures, Yahoo!, Microsoft, Valve Software, TDK Electronics.

Ex-Chrome Developer Relations.