PDA

View Full Version : 3D primitives???



Rajveer
04-23-2002, 04:36 AM
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).]

jimmi
04-23-2002, 04:45 AM
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

Gavin
04-23-2002, 06:28 AM
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)

coredump
04-23-2002, 07:13 AM
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

jimmi
04-26-2002, 05:25 AM
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

coredump
04-26-2002, 05:31 AM
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

Deiussum
04-26-2002, 06:29 AM
The teapot is basically a glut thing, as well. There is no

glBegin(GL_TEAPOT);

jimmi
04-26-2002, 06:36 AM
Originally posted by Deiussum:
The teapot is basically a glut thing, as well. There is no

glBegin(GL_TEAPOT);



I wish there were, then we could request glHandlef(...) and glSpoutf(...) calls in opengl 1.3 http://www.opengl.org/discussion_boards/ubb/wink.gif

jimmi

PkK
04-28-2002, 05:59 AM
How about using 3D Textures?

Robbo
04-28-2002, 08:10 AM
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.