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: Texturing Objects build from Triangles

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    235

    Texturing Objects build from Triangles

    I know how to put a Tga or pcx as Texture on
    -for example- a Quad with glTexImage2f.
    But how do I map these Texture on a Object
    -for example- a sphere,which consist of Triangles(Faces),if I want the bitmap to cover the whole sphere and not only a single face?

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Calgary,Canada
    Posts
    8

    Re: Texturing Objects build from Triangles

    XBCT: Texture coordinates. For every triangle you are going to have to figure out its texture coordinates (glTexCoord2f(). 2d Texture Coordinates are 2 values between 0.0f - 1.0f. OpenGL uses these values to texture your object in ratio to its texture (glBindtexture).

    After thinking about this problem, an interesting solution might be to draw a highly tesselated plane with your texture, and then actually compute the sphere vertices using sin and cos functions to manually create the sphere (you'll have to find the exact equation to build a sphere/elipse/cone). -- just for the sheer hell of it.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    235

    Re: Texturing Objects build from Triangles

    Thank´s Nathan d'Obrenan after some experimentation i got it to work!
    Ps.:i´ll try your idea with a plane and cos and sin next.

Posting Permissions

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