How to fill with color a line strip

Hi, I am drawing some figure using GL_LINE_STRIP, & I wonder how could I fill it with color. I couldn’t use GL_POLYGON instead of line strip because I also have some translation & rotation there (I am doing 1 translation & rotation 4 times to obtain my figure)… & I don’t want to calculate all those coordinates manually. Please give me some idea how could I do that :frowning:

Try glLineWidth

Try glLineWidth

What is the relation between the answer and the question?

I am drawing some figure using GL_LINE_STRIP, & I wonder how could I fill it with color.

What do you mean exactly by fill a line with color? You can call glColor at each line vertex to change its color.

Sorry, I actually ment the GL_LINE_LOOP not GL_LINE_STRIP, & I wanted to fill with color the figure I get, which is a concave polygon.

Ah… you want to fill the polygon, not the line. :smiley:
You can use glu tasselator but it’s archaic.
http://glprogramming.com/red/chapter11.html

Otherwise you have to decompose the polygon in triangle and use GL_TRIANGLE to draw it.

There are some algorithm in the web:
http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/97/Ian/cutting_ears.html

http://valis.cs.uiuc.edu/~sariel/research/CG/applets/convex_decomp/Default.html

@dletozeun:
Cause fill a line don’t make any sense to me I thought that she need a way to make the line more “visible”.

Cause fill a line don’t make any sense to me I thought that she need a way to make the line more “visible”.

Ah, I get it! :slight_smile:

I couldn’t use GL_POLYGON instead of line strip because I also have some translation & rotation there (I am doing 1 translation & rotation 4 times to obtain my figure).

I can’t understand this sentence, drawing lines or a polygon it is the same problem, the second just fill the shape content. Could you elaborate a bit more?

I didn’t use GL_POLYGON which would have solved the color problem because I read I can’t call glTranslate & glRotate between glBegin(…) and glEnd() :slight_smile: .

Well, at last I how ever calculated all the coordinates manually & called glBegin(GL_TRIANGLE_FAN), but didn’t use tessellation but instead chose decomposing it in triangles, as you said, & that finally worked :slight_smile: !!!
So thanks a lot !!!