Extrusion

1 view
Skip to first unread message

Hicks, Matt

unread,
Jul 6, 2010, 6:42:14 PM7/6/10
to sgin...@googlegroups.com
This e-mail is mostly for Landei, but if he's not around perhaps someone else will know the answer to my question.

I've been looking at the Extrusion class and it all makes sense to me (amazing how simple the FlatteningPathIterator makes everything) but I'm not sure how to take this from the outlines and define the filled outlines to render text to the screen with this method.  Can someone point me in the right direction as I am curious the performance difference this will have versus using bitmapped fonts.  Granted lots of tweaking can be done with VBO and such to get better performance, but I would really like to make some progress on this.

Thanks,

Matt

Landei

unread,
Jul 7, 2010, 2:26:11 AM7/7/10
to sgine-dev
Hello Matt,

In order to draw the "front sides" of a font, the glyphs must be
triangulated first. There are several algorithms to do this, e.g. ear-
clipping or scan-line. One special problem is that most algorithms
support simple polygons (without "holes") only, so a step for
connecting all holes with the outer outline may be necessary as well.
The algorithms have not only different runtimes but also different
"quality" (e.g. a simple ear-clipping might produce a lot of very
pointy triangles which are bad for 3D rendering). Very sophisticated
algorithms might even add vertexes to get better triangles. There are
also easy algorithms that introduce new points on edges, but we should
avoid these because of the known problems with T-joins in 3D graphics.

I already made some experiments, but couldn't get even ear-clipping
working so far. I downloaded lots of trinangulation code, but most of
it is in C/C++ and "serious" implementations are huge. Even the stuff
used now in JME looks quite complicated.

Regards,
Daniel

Hicks, Matt

unread,
Jul 7, 2010, 8:35:00 AM7/7/10
to sgin...@googlegroups.com
Thanks for the feedback.  Do you plan on continuing this endeavor in Sgine or have you pretty much abandoned it?

Landei

unread,
Jul 7, 2010, 2:22:29 PM7/7/10
to sgine-dev
I didn't abandon it, but I'm really slow - a mixture of general
lazyness, the heat in Germany and of course the World Championship,
sorry :-)

If you want to go faster, I can give you what I have and the C/C++
implementations I found. Else I would try to give it another shot this
weekend.

Oh, Germany vs Spain starts in 10 min...

Cheers,
Daniel

On 7 Jul., 14:35, "Hicks, Matt" <mhi...@captiveimagination.com> wrote:
> Thanks for the feedback.  Do you plan on continuing this endeavor in Sgine
> or have you pretty much abandoned it?
>

Hicks, Matt

unread,
Jul 7, 2010, 3:48:11 PM7/7/10
to sgin...@googlegroups.com
hehe, no worries, just excited about the functionality and hopeful to see if implemented soon. :)

Enjoy the World Championship, this can wait a little bit longer. ;)

Hicks, Matt

unread,
Jul 9, 2010, 3:03:39 PM7/9/10
to sgin...@googlegroups.com
Landei, I'm not sure if you've looked into it, but I played with zShapes a while back and was considering integrating into Sgine.  It might be worthwhile looking at to determine if we might want to follow that approach?

Here's link:
http://www.javagaming.org/index.php/topic,14778.0.html

Daniel Gronau

unread,
Jul 11, 2010, 1:12:45 PM7/11/10
to sgin...@googlegroups.com
Hi Matt,

Ear clipping for simple polygons started to work just a few minutes ago (I put my own attempts in the trash can and translated a tiny Java implementation). The code is very short (~130 lines), but still needs heavy fine tuning. Of course two additional steps (hierarchy of holes, connecting holes with outer poly) are needed to make it really useful. I attached a screenshot of the first triangulation using that code (as mentioned without correct holes).

Of course I'll have a look at the lib you suggested. A good scan-line algorithm etc would beat the crap out of ear clipping for bigger polygons.

Cheers,
Daniel

2010/7/9 Hicks, Matt <mhi...@captiveimagination.com>
triangulation.png

Hicks, Matt

unread,
Jul 11, 2010, 1:48:26 PM7/11/10
to sgin...@googlegroups.com
That's impressive.  I look forward to seeing how this turns out.

Hicks, Matt

unread,
Jul 11, 2010, 7:23:08 PM7/11/10
to sgin...@googlegroups.com
Daniel,

Would this perhaps help get us to our goal faster:

http://glprogramming.com/red/chapter11.html

If you think this is worth a try I might spend some time with it.

Let me know,

Matt

Landei

unread,
Jul 12, 2010, 2:41:18 AM7/12/10
to sgine-dev
Hi!

I'm not really familiar with OpenGL. If I understand this doc right,
OpenGL *is* able to render simple convex polygons, and the page shows
how to break up complex polygons (even with holes) in simple ones,
both things that are new to me. So yes, it seems this could work.
AFAIK, fonts may use different winding rules, but this would be a
minor issue (in fact, my triangulation code has already a method to
determine if a polygon runs clockwise or not).

So if you can get this running, it would be clearly better than every
external lib or my code.

Cheers,
Daniel

On 12 Jul., 01:23, "Hicks, Matt" <mhi...@captiveimagination.com>
wrote:

Hicks, Matt

unread,
Jul 12, 2010, 10:56:17 AM7/12/10
to sgin...@googlegroups.com
I'll try to play with this a bit this week.

Anyone else on the list done anything with GLUTesselator?

Hicks, Matt

unread,
Jul 13, 2010, 8:22:09 PM7/13/10
to sgin...@googlegroups.com
AWESOME!  Check out TestTesselator!!!!

test_tess_font.jpg

Landei

unread,
Jul 14, 2010, 5:48:18 AM7/14/10
to sgine-dev
Hey,

looks like I can stop working on a triangulator :-)

I guess that code is faster and more robust than everything we could
write ourself. Just to be on the sure side, could you try if it works
for complicated fonts as well (some complicated Japanese examples: 警察,機
械, 動物園, 暖房)? And could you make the single triangles somehow visible
(to see if the algorithm avoids too "pointy" ones)?

Cheers,
Daniel

On 14 Jul., 02:22, "Hicks, Matt" <mhi...@captiveimagination.com>
wrote:
> AWESOME!  Check out TestTesselator!!!!
>
> [image: test_tess_font.jpg]
>
> On Mon, Jul 12, 2010 at 9:56 AM, Hicks, Matt
> <mhi...@captiveimagination.com>wrote:
>
> > I'll try to play with this a bit this week.
>
> > Anyone else on the list done anything with GLUTesselator?
>

Hicks, Matt

unread,
Jul 14, 2010, 4:41:48 PM7/14/10
to sgin...@googlegroups.com
Sure, I just got that basic demo together but I plan to spend a lot more time figuring it all out.  The only thing I'm a bit concerned about is texturing and colorizing it.
Reply all
Reply to author
Forward
0 new messages