hi,
I'm having a problem with showing a model that i have loaded from a object file, the vertexes and indices are loaded oke in to 2 vectors in a seperate class. Below you see my creat methode i have set the lines in bold that have changed for drawing the loaded object in place of a hardcoded one. I think the problem lays with one of these lines. Also i have added my model class as a file.
Thank you for all the help
ShaderIds[1] = LoadShader("\\Debug\\SimpleShader.fragment.glsl", GL_FRAGMENT_SHADER);
ShaderIds[2] = LoadShader("Debug\\SimpleShader.vertex.glsl", GL_VERTEX_SHADER);
ShaderIds[0] = glCreateProgram();
ExitOnGLError("ERROR: Could not create the shader program");
glAttachShader(ShaderIds[0], ShaderIds[1]);
glAttachShader(ShaderIds[0], ShaderIds[2]);
glLinkProgram(ShaderIds[0]);
ExitOnGLError("ERROR: Could not link the shader program");
ModelMatrixUniformLocation = glGetUniformLocation(ShaderIds[0], "ModelMatrix");
ExitOnGLError("ERROR: Could not get the shader uniform locations for modelmatrix");
ViewMatrixUniformLocation = glGetUniformLocation(ShaderIds[0], "ViewMatrix");
ExitOnGLError("ERROR: Could not get the shader uniform locations for viewmatrix");
ProjectionMatrixUniformLocation = glGetUniformLocation(ShaderIds[0], "ProjectionMatrix");
ExitOnGLError("ERROR: Could not get the shader uniform locations for projectionMatrix");
glGenVertexArrays(1, &BufferIds[0]);
ExitOnGLError("ERROR: Could not generate the VAO");
glBindVertexArray(BufferIds[0]);
ExitOnGLError("ERROR: Could not bind the VAO");
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
ExitOnGLError("ERROR: Could not enable vertex attributes");
glGenBuffers(2, &BufferIds[1]);
ExitOnGLError("ERROR: Could not generate the buffer objects");
glBindBuffer(GL_ARRAY_BUFFER, BufferIds[1]);
//glBufferData(GL_ARRAY_BUFFER, sizeof(VERTICES), VERTICES, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, 256/*sizeof((*model).GetVertices().size())*/, &(*model).GetVertices(), GL_STATIC_DRAW);
ExitOnGLError("ERROR: Could not bind the VBO to the VAO");
//glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(VERTICES[0]), (GLvoid*)0);
//glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VERTICES[0]), (GLvoid*)sizeof(VERTICES[0].Position));
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof((*model).GetVertices()[0]), (GLvoid*)0);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof((*model).GetVertices()[0]), (GLvoid*)sizeof(&(*model).GetVertices()[0].Position));
ExitOnGLError("ERROR: Could not set VAO attributes");
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, BufferIds[2]);
//glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(INDICES), INDICES, GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 144/*sizeof((*model).GetIndices().size())*/, &(*model).GetIndices(), GL_STATIC_DRAW);
ExitOnGLError("ERROR: Could not bind the IBO to the VAO");
glBindVertexArray(0);