• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Vertex Array

## Recommended Posts

Hi! I want to make a CVertexArray class. The basics of the design are clear, but i have 2 questions. 1. Is ist good to use a std::vector to represent e.g. vertrices of this vertex array? class CVertexArray { ... protected: std::vector m_Vertices3f; } or is it better to make it so: class CVertexArray { ... protected: float* m_Vertices3f; } Which of this two solutiins are faster? 2. There are many extensions for vertex arrays I have seen. Now could any one tell me wich are very usefull? I use yet GL_EXT_compiled_vertex_array.

##### Share on other sites
mentat    122
1. As far as I know, use of std::vector for vrtices is problematic. In both memory and speed.. (I hope stl guys don't flame me for that)

I would rather use a vertex class for that, such as

class CVertex3D{public:  float x, y, z;};

EDIT: code tags..

[edited by - mentat on January 28, 2003 7:52:14 AM]

##### Share on other sites
A good idea. Then my CVertex class would be this:

class CVertex
{
public:
CVector3 m_Position; // The vertex position
CVector3 m_Normal; // The vertex normal
float m_TexCoord[4]; // 2 sets of texture coordinates
};