PDA

View Full Version : gluCylinder - joining



TEWarehouse
11-28-2012, 02:00 PM
I have several gluCylinders in a row basically one after another to create a tube effect that turns, etc.

everything looks and works fine.

However there are spaces between the cylinders. How do i join all the cylinders togeter to make just one solid cylinder?

The cylinders twist and turn which is part of the reason there are spaces.

Is there a simple way to connect them all or do i need to re-write a cylinder script to do this?


GLUquadric* thA;
thA = gluNewQuadric();
gluQuadricNormals(thA, GLU_SMOOTH);
gluQuadricDrawStyle(thA, GLU_FILL );

for(------)
{
///do some translate and rotates
glucylinder(thA, radius, radius, distance, slices, stacks);

}

tonyo_au
11-29-2012, 10:35 PM
The quick way (if you don't need to look inside the cylinders) is to render a sphere located at the intersection of the vectors passing along the axes of adjacent cylinders with same radius as the cylinder - basically a ball joint. Other options
require much more work.

TEWarehouse
11-30-2012, 09:49 AM
Yeah that make sense.

Can i change the end point of the cylinders so they 'tilt'?

Is there a GLUCYLINDER function i can copy and paste and modify to do what i need it to do?

tonyo_au
11-30-2012, 05:14 PM
The source for the glu is available online - try http://mesa3d.org/.

If you really want to render poly pipes you will need to look at something like GLE tubing and extrusion http://linas.org/gle/ .
This is quite a big topic. The sdk only produces old OpenGL code.

V-man
12-01-2012, 06:22 AM
There is my glhlib which has a function called glhCylinder.
It just computes the cylinder and gives you the indices and vertices. See the header file for an example. Sorry dude, it doesn't do cylinder joining. Maybe in the future, I'll add that.