PDA

View Full Version : Wire objects



11-26-2003, 03:36 AM
How can i draw a wire object(like cone) so i
can see only this part of the object that is in front of me(like the way you see solid cone)

mikael_aronsson
11-26-2003, 05:22 AM
Hi !

This requires some kind of hidden line removal and is not included in OpenGL so you have to find some library that can help you with it, OpenCascade for example has hidden line removal but this is overkill to use and I am sure there are smaller libraries out there that can help you out with.

I don't know if it would be tricky to implement on your own.

Mikael

maximian
11-26-2003, 06:44 AM
This is simple to do:

glEnable(GL_DEPTH_TEST);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
set_color(foreground);
draw_object_with_filled_polygons();

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0, 1.0);
set_color(background);
draw_object_with_filled_polygons();
glDisable(GL_POLYGON_OFFSET_FILL);

11-28-2003, 06:42 PM
mikael_aronsson:
The code must be very small and extra library is not a option.
maximian:
Substitute
draw_object_with_filled_polygons();
with auxSolidCone(x,y);
and
set_color(foreground);
auxColor3d(a, b, c);
and rotate the cone. You will see that the result is not alwayes what i whant.

Thanks anyway.
Other suggestions?

maximian
11-28-2003, 07:32 PM
I am not sure about the aux call, but there is another approach. You can build an edge list, which stores for each edge, polygon a,b that share it. Then you test the normal* inversemodelview. Then if one of the polygons
faces the viewer by any amount, amount you determine, then draw the edge. That should work. Not sure how fast though.