PDA

View Full Version : thickness

Rajveer
04-18-2002, 06:34 AM
I've drawn a 3D hollow cylindrical tunnel type of shape using
glBegin(GL_QUAD_STRIP); I want the walls to have some thickness, but I don't want to just draw a slightly smaller tunnel inside the tunnel....I want it to be completely solid so that if I were to then clip off the ends with two clipping planes, I would still see a thickness and not the appearance of one cylinder inserted into another....
can anyone help?

I know that glLineWidth() can be used to make thicker lines, does this work for shapes also. i.e. could I draw squares of a specified thickness using glBegin(GL_QUADS) ??

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

Gavin
04-18-2002, 08:13 AM
A polygon is an infinately thin surface.

Rajveer
04-18-2002, 08:19 AM
I see....
so is there any other way to give the shape thickness?

Originally posted by Gavin:
A polygon is an infinately thin surface.

Bob
04-18-2002, 08:24 AM
You could search the web (http://www.google.com) for CSG, constructive solid geometry. I haven't use CSG much, but I believe you can simulate thickness with some of the operations you can do.

Sorry, but I can't provide much usefull information on the area, but I have a feeling it should be doable with the help of some CSG. Maybe someone else here can give some more info.

nexusone
04-18-2002, 10:42 AM
Use two gluCylinder and two gluDisk:

The disk can have a hole in it, so you make the disk the end's pices of you cylinder. The diffrence between the ID and OD is your thickness.
The outside cylinder will be the same as the disk's OD (outer diameter), and the inside cylinder will be the same size as the ID (inner diameter).

Example:

**************** Outer Cylinder, normals map out.
|_disk_1__disk_2|
**************** Inner Cylinder, normals map inward

****************
|_disk_1__disk_2|
*****************

http://www.opengl.org/discussion_boards/ubb/smile.gif

Originally posted by Rajveer:
I see....
so is there any other way to give the shape thickness?

[This message has been edited by nexusone (edited 04-18-2002).]

Bob
04-18-2002, 08:55 PM
nexusone, I'm not sure that's what Rajveer is looking for. See, if you move your viewpoint very close to your cylinders, so close that the near plane will clip the outer and inner cylinder, you will see the space between the two cylinders. Your cylinder is still hollow, a surface with nothing inside. I belive Rajveer want's a solid inside, and then you must, manually, fill the holes caused by the clipping.

Gavin
04-19-2002, 12:04 AM
voxels?

04-20-2002, 09:52 AM
you could also whats on http://toolbox.sgi.com/linux/documents/OpenGL/advanced99/notes/node21.html

basically:
-with z-buffering on (always)
-clear stencil, color, depth buffer
-draw the scene, front facing polys only
-turn off color writes
-set stencil to increment
-draw the scene, back facing polys only
-turn on color writes
-set stencil function to GL_EQUAL to 1
-draw a CAPPING POLYGON
-normalize states(turn off stenciling, etc)

the CAPPING POLYGON is a quad(or 2 tris) that covers the entire screen. that poly will only be drawn where the inside of the scene can be seen. the disadvantage is that you get only one interior texture for the whole scene.

the level geometry must be absolutely hollow hulls, no loose polys into them, or it will look weird.