View Full Version : How to draw a polygon with GL_FILL and GL_LINE
04-04-2009, 08:22 AM
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?
04-04-2009, 10:17 AM
If I understand your question correctly what you need to do is draw them twice.
Once using :
.. and then again using :
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..
04-04-2009, 02:32 PM
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?
04-04-2009, 08:33 PM
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. ;)
04-05-2009, 02:44 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.