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

Thread: U V Coords and Vertex Arrays

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Israel
    Posts
    9

    U V Coords and Vertex Arrays

    The rendering in the engine I currently work on is preformed using vertex arrays. My job is to write code that calculates the U and V texture coordinate of each vertex of some models, and write the vertices into a vertex array.

    That is obvious that most of the vertex coordinates in the vertex array will have more then one UV coordinate (for example, the coord (1,2,3) in one poly has the different UV values then in another one that shares the same vertex-coord). Because of that, I will have to write the same coordinate couple of times into the vertex array just because the UV values are different!

    It seems that this will result in a very big vertex array! Are there any other techniques for texture mapping without writing the same vertex into the vertex array couple of times?

    Thanx for reading , Max

  2. #2
    Junior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Lubbock, TX, USA
    Posts
    224

    Re: U V Coords and Vertex Arrays

    Use primitives like triangle strips/fans or quad strips/fans. They have shared vertices, and every vertex in a strip is only defined once.

  3. #3
    Intern Contributor
    Join Date
    Mar 2001
    Posts
    58

    Re: U V Coords and Vertex Arrays

    Originally posted by Maxim:

    That is obvious that most of the vertex coordinates in the vertex array will have more then one UV coordinate
    As far as I understand, you want different textures to be on most of adjacent polies.
    If so, you probably have to write your vertex coordinates repeatedly. This also
    implies that you have to render your geometry by polygons. That can make a huge call overhead.
    However, you can consider another way. Use, as Dodger said, strips (or other primitives)
    in a vertex array and apply only one texture to the array. You can compose that single texture from many small textures and change it "on fly" with TexSubImage.
    It would be faster.
    Alexei.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: U V Coords and Vertex Arrays

    First of all, I think both of you mis-diagnosed Maxim's problem. What he is saying is that adjacent polygons may have different sets of texture coordinates. Because of that, he is forced to dupicate a vertex position, which increases the size of the vertex array.

    Unfortunately, this is the nature of vertex arrays. Your index is an index into each of your separate arrays, so if you need a vertex that has a certain position, but two sets of UVs, you will need to have that position in two places in your vertex array.

  5. #5
    Intern Contributor
    Join Date
    Mar 2001
    Posts
    58

    Re: U V Coords and Vertex Arrays

    Maybe there was some misunderstanding. I thought that Max asked about other techniques of texture mapping. If you use a composite texture, you need only one set of texture coordinates at each vertex. It was just a suggestion.
    Alexei.

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    Israel
    Posts
    9

    Re: U V Coords and Vertex Arrays

    Thanx a lot Korval, that was exactly what I wanted to know!

  7. #7
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    159

    Re: U V Coords and Vertex Arrays

    Told you...

Posting Permissions

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