Hello, Getting back into programming after a few years off and a bit rusty.
My question is: Is this going to initialize the size of the vector array's position and color properly?
#include <GLFW/glfw3.h>
#include <vector>
class TerrainClass
{
private:
struct VertexType
{
std::vector<float> position[3];
std::vector<float> color[4];
};
public:
TerrainClass(void);
~TerrainClass(void);
nah, you've defined 2 separate vectors there.
Actually they are 7 vectors.
Thanks very helpful. Seems to work now. This is what I have done: ..........Using OpenGL and G++, linux
class TerrainClass
{
private:
struct VertexType
{
std::vector<float> position;
std::vector<float> color;
};
<code snip>
bool TerrainClass::InitializeBuffers(GLFWwindow* window)
{
VertexType* vertices;
unsigned long* indicies;
int index, i, j;
float positionX, positionZ;
vertices = new VertexType[m_vertexCount];
positionX = (float)i;
positionZ = (float)(j+1);
vertices[index].position = {positionX, 0.0f, positionZ};
<code snip>
I also had to include a compilier flag for std=gnu++11 to load the vector.