more on rendering usin g the GPU.
it does if it's architectured right, see for instance how the Pathfinder library does it it doesn't if it needs back-and-forth stuff with cpu and gpu involved (anyway, 2am, going to bed) oliverthered 1:37 AM ok, I'll run a test soon of calculating all the line points an entire SVG file in one go to see how that performs. but you're correct, unless there's some way you can work with the line points when rendering an image on the GPU you have to shuttle the calculations between the GPU and CPU to do the drawing. that then leaves the question of how often do you actually have to recalculate all the drawing points. you could calculate the drawing points as a triangular strip maybe. Then it's just one trip to the GPU and back to calculate them and then you change the data type into vertices and send them off to the GPU again to be rendered. you should then be able to manipulate the line directly on the GPU you just can't break it or delete it without having to go from GPU to CPU again. Filling is a lot harder on any kind of scale. Here's one example of SVG filling on the GPU: http://matthieu.besson.pagesperso-orange.fr/2010.01.15/SVG Rendering using OpenGL.html
matthieu.besson.pagesperso-orange.fr SVG Rendering using OpenGL
line drawing is however fixed filling not dynamic filling, you know the width you don't have to do bounds checking for the fill boundary. and it's still possible to do that on the CPU as a mask and then have the GPU render the fill texture and style etc.. an array of drawing points need be no bigger than a few full screen 32bit depth textures to fill the whole screen with lines. If you can create an array of triangles at point separation using the tangents of the spline you should then be able to use a shader to do all the stroke drawing, feeding it the array of triangles you've calculated. anyhow, i'll have to do some benchmarking, but in theory at least everything apart from creating a mask for filling can be handled by the GPU.
So to do all of that you need to know the length of the lines so you can precalculate the size of the array needed to hold the triangular stipes at one pixel spacing..
participants (1)
-
NASA Jeff