Page 1 of 1

Polygon Edges...

Posted: Mon Oct 05, 2009 5:40 am
by Sylus101
Quick and easy question I'm sure... is it possible (without textures) to have the polygon edges be drawn a different color than the color filled inside?

Re: Polygon Edges...

Posted: Mon Oct 05, 2009 9:17 am
by Discostew
If you're thinking of something along the lines of an outline of a character model, then yes, but there are some rules. Obviously, you have to enable it with glEnable(GL_OUTLINE), but it is on or off on a per-frame basis, not per-polygon. Next, decide what colors you want to use to draw the edges. You can have up to 8 colors. Load them via glSetOutlineColor(), with an id from 0-7, and the 15bit color value. The last thing to do is for each polygon, set the PolygonID to match the id used earlier. The hardware is set up so that the first 8 PolygonIDs (0-7) go with outline id 0, the next 8 (8-15) with outline id 1, and so forth, up to the last 8 PolygonIDs (56-63) with outline id 7.

Because it is on a per-frame basis, when it is on, it will affect all polygons. But, I think there is a way around this to prevent some polygons from "looking" like they have it when it is set. Imagine a crate in front of some scenery, and you want just the crate to have the outline, not anything lse. To make the scenery look like it doesn't have edge coloring (including landscapes, buildings, the sky(box), etc.), you'd set the box to one polygonID group, and you'd set everything else to another.

To be honest, I've never touched edge coloring before, so I'm not completely sure if I'm missing anything else with the setup.



But, if you meant something along the lines of each polygon having a distinct edge color (like the wireframe laid over the 3D), then you can use your original idea of textures, or use edge coloring, but ensure that adjacent polygons use different polygon group IDs.

Re: Polygon Edges...

Posted: Mon Oct 05, 2009 4:39 pm
by Sylus101
The outline worked, but what is interesting about it is that it simply outlined the visible portion of the model, so just all around the outside and not each actual edge. It's a start though, and I think this is what you were describing. I suppose changing the polyId to fit with with a different outlineId would work, but to get the outline of just a simple box would eat all the 8 outline Id's very quickly.

Thanks again, you've been a massive amount of help.