Is there an easier way?


I’ve done some reading and I’m beginning to understand OpenGl. I’ve got a few things working like a spinning cube etc and I understand all my model/projection transformations.

Now I’ve started to work on something more complicated, a simple maze for a car to drive through but I’ve been struck by how difficult it is to draw even simple shapes.

I was thinking about a function to draw an extruded shape where you could define a list of points on a plane and a depth and the function would do all the work of drawing all the polygons of the faces and calculate the normals. However, this function would be hard to do if the shape defined by the list of points was not convex. Are there libraries of functions out there for simplifying these sort of tasks or am I missing something simple?

It seems as though all the objects in source code I have seen have been very simple and haven’t really helped me design any good data structures or given me good ideas.

I’d really appreciate any help or pointers in the right direction.



Well, you should have a look at . The page itself has nothing to do with what you are asking, but the code below has. There is some code for extruding polygons to solid objects. It can handle non-convex shapes too. The function you might wanna look at is called extrudeSolidFromPolygon(), located somewhere in the top third of the code.