Results 1 to 4 of 4

Thread: How to define spheric texturing

  1. #1

    How to define spheric texturing

    I have a small problem which partly will define how my whole model engine works so it needs to be thought out. I have a solution but it is not perfect, however i don't see how it could be.

    At the moment 3D engine uses OpenGL to render Vertex arrays; series of GL_TRIANGLES. Rendering is done with glDrawElements that is fast (even faster than glDrawArrays i've heard too...) and reduces needed memory by having list of vertices and faces only remember index to each vertex, so a dynamic and light way. Each vertex has a corresponding (and equal length) normal, texture and color arrays all optional depending on model and visual needs.

    Problem:
    When making a sphere using these definitions, texture coordinates will "loop through". For example, take texture X coordinate for any given face:
    - Face 4 could have X ranging 0.5 .. 0.6
    - Further 0.9 .. 1.0
    - And finally 1.0 .. 0.1 (or 0.9 .. 0.0) this is where single face will span an entire texture

    Solution:
    I could think modelling program would be responsible to create an overlapping vertex for each side of sphere. Think of it as a paper that is bended so that edges touch... But this solution is first of all minor detail error to normals. It becomes impossible to create perfectly smooth normal if model is "broken" in the middle. Secondly it makes model little less dynamic or slower where you have to move 2 vertices that are overlapped in case of animation. Finally it takes that little bit more memory for extra vertices...

    Another solution is the memory mass that would have each triangle a unique vertex... i wouldn't want to move to that really. Old GLEngine was mix of both but it didn't use any array rendering, only glBegin-glEnd.

  2. #2

    How to define spheric texturing

    You dont have to create additional overlapping vertices. Just draw the vertices that begin horizontal strip twice, as first ones and last (overlapping) ones, but each time with different texture coordinates.

    This means that information about texture coordinates should be stored not in the vertex but in the face structure.

  3. #3

    How to define spheric texturing

    Quote Originally Posted by grudzio
    This means that information about texture coordinates should be stored not in the vertex but in the face structure.
    This is what i did before but now, i don't know a way to do it with vertex arrays. The system seems to tie textures and normals to same indexes with vertices.

  4. #4

    How to define spheric texturing

    When drawing with vertex arrays, adding overlapping vertices with new texture coordinates seems to be the only way, I am afraid.

Bookmarks

Posting Permissions

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