views:

202

answers:

2

So I have this irregular shaped polygon. I draw it by filling the inside with triangles.

The outside I added a border by used GLLineLoop.

Now I want to draw second line (of a different color) inside. any ideas on how to do that?

Line1: ================

Line2: ----------------

Not

Line1(width 3): ================

Line2(width 1): ----------------

Line1(widht 3): ================

A: 

Draw the outside line first. Stack on top of that the polygon. Then draw on top of that the inner line. If the first line is wider than the last line, it will look like what you describe. A three pixel outside line, and a one pixel inside line will appear as two one pixel lines.

If this is a 3D item, and you need to show both sides, you'll have to stack these on both sides.

Mr. Berna
this isn't quite working for me I maybe misunderstanding what you are saying.This is what I am seeing:Line1Line1Line1Line1Line1Line1Line1Line1Line1Line2Line2Line2Line2Line2Line2Line2Line2Line2Line1Line1Line1Line1Line1Line1Line1Line1Line1instead of Line1Line1Line1Line1Line1Line1Line1Line1Line1Line2Line2Line2Line2Line2Line2Line2Line2Line2
Mel
The polygon should cover the inside half of the outer line. One reason this may not be working for you is that OpenGL doesn't guarantee elements will be drawn in the order you specify them. To make sure this works, translate the vertexes slightly closer to the camera for each layer.
Mr. Berna
+1  A: 

Draw the outer line first with about double the width you want it to be, then the polygon, then the thinner inner line.

Noah Witherspoon