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 3 of 3

Thread: Glut textures

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2002
    Posts
    9

    Glut textures

    How can I bind a texture to a solid glut sphere for example??

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: Glut textures

    Originally posted by laf:
    How can I bind a texture to a solid glut sphere for example??
    From 3.7.6, glut_shapes.c:

    void APIENTRY
    glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
    {
    QUAD_OBJ_INIT();
    gluQuadricDrawStyle(quadObj, GLU_FILL);
    gluQuadricNormals(quadObj, GLU_SMOOTH);
    /* If we ever changed/used the texture or orientation state
    of quadObj, we'd need to change it to the defaults here
    with gluQuadricTexture and/or gluQuadricOrientation. */
    gluSphere(quadObj, radius, slices, stacks);
    }

    Fromt he docs on gluSphere:

    The gluSphere function draws a sphere of the given radius centered around the origin. The sphere is subdivided around the z-axis into slices and along the z-axis into stacks (similar to lines of longitude and latitude).

    If the orientation is set to GLU_OUTSIDE (with gluQuadricOrientation), any normals generated point away from the center of the sphere. Otherwise, they point toward the center of the sphere.

    If texturing is turned on (with gluQuadricTexture): texture coordinates are generated so that t ranges from 0.0 at z = –radius to 1.0 at z = radius (t increases linearly along longitudinal lines); and s ranges from 0.0 at the positive y-axis, to 0.25 at the positive x-axis, to 0.5 at the positive y-axis, to 0.75 at the positive x-axis, and back to 1.0 at the positive y-axis.

    Hope this helps.

    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2002
    Posts
    9

    Re: Glut textures

    Thanks for your answer. I have already done this way. But my problem is that I have several objects created based on glut (not glu) objects and I rather prefer not to change them all.

    Thanks

Posting Permissions

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