3D primitives???

Are there any 3D primitives using openGL. I know that all 3D primitives can be constructed from 2D primitives, I want a shape that is solid. For example, if I constructed a red cube from six squares, it would be hollow. And if I were to cut the tops and bottoms off with two clipping planes, i would see a hollow tunnel as a result. I want a shape that is completely coloured on the inside, and I want it such that if I were to specify different colours for each vertex, it would smoothen the colours across the shape in 3D just like for 2D primitives.

And I can’t just redraw two side of the shape after the cutting planes have been placed. I’m writing a program to view 2D cross sections of a 3D model (achieved using two clipping planes, very close to each other). And I allow the user to define the clipping plane, so I don’t actually know where the clipping plane is going to be, and it would be way way way too complicated to figure out based on the plane equation and all the vertices of my model, what portions have been clipped and where to draw a new polygon to cover the region. So basically, I just want an easier way to do it, and I’m hoping that there are 3D primitives cause that would make it really easy.

[This message has been edited by Rajveer (edited 04-23-2002).]

I don’t know of any 3d primitives in opengl that behave in this manner. Are all your models meshes? It seems that for your purposes a volumetric model such as CSG or voxels would be more appropriate (and there is no direct support for these via opengl). What is your application?

jimmi

Nothing draws solidly, everything works in the same way as opengl in the beginning, They just implement some algorithm to close the ends of (such as whenm you clip)

isn’t the teapot implemented as a primitive? i seem to remember my Computer Graphics professor telling me this. but it may only exist in glut. however, you can see it in the 3d pipes screensaver, this may not have been written in glut.

b

Originally posted by coredump:
isn’t the teapot implemented as a primitive?

The teapot isn’t solid, in the same way that quadrics (gluSphere, gluDisk etc.) aren’t solid. These functions just render the surface of the relevant object. If you placed a clip plane which bisected the teapot you would see that it is hollow.

jimmi

oh, i never said it was solid…just that it’s 3d. and the color plates in the red book show examples of a teapot with the side carved out, showing the insides. but yes, it has no thickness.

b

The teapot is basically a glut thing, as well. There is no

glBegin(GL_TEAPOT);

Originally posted by Deiussum:
[b]The teapot is basically a glut thing, as well. There is no

glBegin(GL_TEAPOT);

[/b]

I wish there were, then we could request glHandlef(…) and glSpoutf(…) calls in opengl 1.3

jimmi

How about using 3D Textures?

Unfortunately, the solution to your problem is `advanced’. You need to slice your model and cap the ends - OpenGL won’t be able to do this for you.

A 3D texture wouldn’t work (it would be way too big for your card).

Voxel rendering might be a solution, but I figure thats just as difficult as the slice\cap option.

I think you should check comp.graphics.algorithms for more information.