On Tue, Oct 21, 2008 at 11:59 PM, Neil Roberts <[EMAIL PROTECTED]> wrote:
> On Tue, 2008-10-21 at 21:28 +0200, Arnaud VALLAT wrote:
>> Please find along with this email the patch. It does not provide gles 
>> routines.
>
> Thanks for the patch, that's pretty cool.
>
> However, one problem with this is that it wouldn't support concave
> paths. Please see the attached screenshot and example program. The path
> in red is how it should appear using cogl_path_fill and the textured
> path on the right is how it appears with cogl_path_fill_with_texture.
>

Yep, that's right, it does not support it. I'm sorry about that...
It's a quick hack to answer a specific need... That's why I was
thinking about doing something better with the second solution :-) I
will need something more powerfull in a near futur :-)

> The current version of cogl_path_fill fills the path using a trick with
> the stencil buffer. It draws the shape as a triangle fan and inverts the
> stencil buffer with each triangle. This works out so that the only parts
> allowed through the stencil buffer are where the path should be filled
> in. Then it simply draws a rectangle through the stencil buffer to fill
> the path. There's a description of this technique in the OpenGL red book
> [1]
>
> You could implement the cogl_path_fill_with_texture by drawing the
> texture instead of a rectangle as the last step. This would make it work
> with concave paths and also avoid the need to calculate the texture
> coordinates.

I thought about that, I've asked the ml few weeks (months?) ago to
know how to do such a thing. Such a method results in doing the
operation twice: render the path in the stencil buffer and then blend
the texture ... I would like to avoid doing operation n times.

>
> Another thing I've been thinking about for the paths is to tessellate
> them into triangles so that we avoid using the stencil buffer
> altogether. In that case we would probably need to calculate the texture
> coordinates again, but it might help with your other idea which was to
> get a handle to a stored path. We could combine this with the Mesh API
> idea from Rob Bragg [2] and store the tessellated path as a mesh. The
> tessellation idea is described in bug #1198.

Tesselation sounds to be a good solution! If you combine this with the
current Mesh API, you also have to change another thing. According to
the current Mesh API, computation of texture coordinates is not done
by the Mesh API itself, right? We can add attributes to the Mesh such
as an array of colors or a texture, but we have to specify
coordinates. The Mesh API does not export Mesh's points, how can we
compute the texture or color coordinates? We can add another function
which computes internally texture coordinates with a given texture?

>
> Thanks,
> - Neil
>
> [1] http://glprogramming.com/red/chapter14.html#name13
> [2] http://bugzilla.openedhand.com/show_bug.cgi?id=1164
> [3] http://bugzilla.openedhand.com/show_bug.cgi?id=1198
>

Thank you Neil :-)

Rno
-- 

  "Given enough eyeballs, all bugs are shallow"
    Eric Steven Raymond
-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to