I want to store some Vertex-Data in two arrays, one for static use and the other one should be dynamic.
The first array will contain the position-data, that's not gonna change, but the second one will contain the texture-coordinates (I use a texture-atlas). They may change at runtime.
Imagine I have two structs:
typedef struct _vertexStatic
{
GLfloat position[2];
} vertexStatic;
typedef struct _vertexDynamic
{
GLfloat texCoords[2];
} vertexDynamic;
I declare my two arrays and I want to initialize them for testing.
//Static (position)
//Four vertices that form one quad in the end
const vertexStatic m_StaticVertexData[4] =
{
{-0.5f, 0.5f},
{0.5f, 0.5f},
{0.5f, -0.5f},
{-0.5f, -0.5f}
};
//Dynamic (texture coordinates)
vertexDynamic m_DynamicVertexData[4] =
{
{0.2f, 0.0f},
{0.3f, 0.0f},
{0.3f, 0.1f},
{0.2f, 0.1f}
};
const GLubyte m_indices[6] =
{
?, ?, ?,
?, ?, ?
};
This initialization is not correct.
I get some array must be initialized with a brace-enclosed initializer and too many initializers for 'const vertexStatic {aka const _vertexStatic} errors while compiling.
My question:
How do I correctly initialize the vertex-data and how would it look for larger amounts of elements?