Vertex Class Design Considerations
While revising my vertex/polygon classes, I came across this certain design consideration. When storing normals and texture coordinates, should I store these in the polygon structure or the vertex structure? Polygons access vertices through vertex indices. If I put the information in the vertex structure, then I will have to duplicate vertices on edges and all that. If I put the information in the polygon structure, then I will have to pass more parameters to some of my functions? What do you think?
- fyhuang [ site ]
ideally you should be rendering using vertex arrays (vertex buffer object extension on top of that).. in this case you must put everything in the vertex structure, and all vertices must be in a continuous block of memory.
I'm not worrying about the rendering yet -- I'm using vertex arrays for that, but I am doing the vertex class for things such as BSP trees and all that. Say you had a 90 degree wall:
If I put the normals in the vertices, for flat shading I would have to have two identical vertices (with different normals) at the corner.
| | |______NORMALS: | -| |______ |
If I put the normals in the vertices, for flat shading I would have to have two identical vertices (with different normals) at the corner.
- fyhuang [ site ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement