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

Thread: Spreading a texture over multiple polygons

  1. #1
    Guest

    Spreading a texture over multiple polygons

    Hello,

    I am just starting to learn OpenGL, and have started by writing a simple landscape engine that works by having each point on the heightmap represent a vertex in a quad.

    Now, I have managed to texture each quad indivdually, but what I really want to do is have one big texture and spread it over the entire scene.

    Can anyone help me?

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    Austria
    Posts
    2

    Re: Spreading a texture over multiple polygons

    You need to set TexCoord2f(x, z); for every vertex. For the lower left for example TexCoord2f(0.0f, 0.0f); for the upper left e.g.: TexCoord2f(0.0f, 1.0f); lower right: TexCoord2f(1.0f, 0.0f); and so on. One image spans all over TexCoord from 0 to 1. If you want to have a picture over mor then one quad you should use values between 0 and 1. e.g.: TexCoord2f(0.3f, 0.2f);

    I recommend you not using quads. you do better with triangles. believe me you got strange results when the 4 points lie not on a plane. The points of a triangle always lies on a plane!

    I hope my english is readable, and i could help you :-)
    Jamf

Posting Permissions

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