Results 1 to 10 of 10

Thread: Creating Spheres

  1. #1

    Creating Spheres

    Is there a function in OpenGL that will create a sphere? How do you create sphere if there is no GL_SPHERE command or something similar...

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Creating Spheres

    You can create a sphere using gluSphere, or simply use the formula for a sphere to create one yourself.
    Deiussum
    Software Engineer and OpenGL enthusiast

  3. #3

    Re: Creating Spheres

    what is the formula for a sphere? isn't it something like sine squared times cosine squared or something like that? Its been awhile since I took a math class.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Location
    King George, Virginia
    Posts
    132

    Re: Creating Spheres

    search google for a guy named paul bourke. his page has just about everything under the sun when it comes to math/trig/geometry

    jebus

  5. #5

    Re: Creating Spheres

    Is there a gluCylinder function too ?

  6. #6
    Senior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    USA
    Posts
    254

    Re: Creating Spheres

    There are a few different versions.

    Wire/Solid Cube - 1 Parameter
    glutWireCube ( 2.0 );
    glutSolidCube ( 2.0 );

    Wire/Solid Sphere - 3 Parameters
    glutWireSphere ( 2.0, 30, 30 );
    glutSolidSphere ( 2.0, 30, 30 );

    Wire/Solid Cone - 4 Parameters
    glutWireCone( 0.5, 1.0, 8, 8 );
    glutSolidCone( 0.5, 1.0, 8, 8 );

    Be sure to include glut.h and glut32.lib

    -VC6-OGL

  7. #7

    Re: Creating Spheres

    ...so there's no glutSolidCone( ) ?

  8. #8

    Re: Creating Spheres

    What if I made my own cylinder. I was thinking of trying a for loop that would create a polygon side and iterate it in a circle. If I want the cylinder to circle around the Y-axis what values do you change the x,y,z in glVertex3f(x,y,z) by?

  9. #9
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    east norwalk, ct, usa
    Posts
    184

    Re: Creating Spheres

    > what is the formula for a sphere?

    r = [constant]


  10. #10
    Junior Member Newbie
    Join Date
    Feb 2002
    Posts
    11

    Re: Creating Spheres

    GLUquadricObj *pObj = gluNewQuadric();
    gluQuadricTexture(pObj, true);
    gluSphere(pObj, size, 32, 32);

    I use GLquadrics, they can be used to create spheres and cones, cylinders etc, search the internet for examples of GLquadrics. They also provide texture mapping co-ordinates, so they are excellent for rendering textures on spheres.

Similar Threads

  1. Spheres
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-09-2004, 01:43 AM
  2. Creating a ChaseCamera in OGL & Creating multiple cameras
    By Nuno Miguel Silva in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-03-2004, 12:45 AM
  3. Two Spheres ..
    By glcrazy in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-05-2003, 02:36 AM
  4. Help creating spheres with coordinates?
    By idistrust in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-11-2003, 02:02 AM
  5. Creating spheres?
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-25-2000, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean