Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: gluCylinder - joining

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    15

    Post gluCylinder - joining

    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);

    }

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    15
    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?

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    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.

  5. #5
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264
    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.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •