How to draw a polygon with GL_FILL and GL_LINE

Hi, i would like to draw the polygons in my application with a line and then fill them. How can i do that, because now i have to choose between GL_FILL or GL_LINE mode and can not use both.
Someone knows how?

If I understand your question correctly what you need to do is draw them twice.

Once using :

glPolygonMode(GL_FRONT, GL_FILL);

… and then again using :

glPolygonMode(GL_FRONT, GL_LINE);

…for example.

Doing it that way around it should look like the polygons have been filled as the line will be drawn afterwards, and depending on how you want the line to augment the polygon you can use different blending modes, colours, turn off depth testing etc.

Obviously the GL_FRONT component could be GL_BACK or GL_FRONT_AND_BACK, depending on your implementation…

More info is here…

This does in fact draw a line around the filled cubes. But i guess the effect is not what i am after. I am trying to let the eye see a difference between the sides of a cube when i use the GL_FILL option. I guess i have to use some sort of shading, am i right?

From what you are saying now it seems that you want to simply look at lighting the cube.

Try reading through this…

( btw going back to your original question… Another way to mark the edges or extremeties of polygons with less overhead is with shaders, but we’ll save that for a bit further down the line. :wink:

Thanx for pointing me in the right direction, i have got it working by adding a lightsource. Now i can see the different sides of the cubes.