This commit is contained in:
Tobias Dahl
2014-03-04 15:49:35 +01:00
parent 2994c525b6
commit 54a5a7a113
4 changed files with 47 additions and 17 deletions
+27 -15
View File
@@ -22,9 +22,21 @@ void Model::temp_CreateModelShit()
Vertices.push_back(0.0f);
Vertices.push_back(2.0f);
Normals.push_back(1.0f);
Normals.push_back(1.0f);
Normals.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
Colors.push_back(1.0f);
}
@@ -35,15 +47,15 @@ void Model::CreateBuffers( std::vector<float> _Vertices, std::vector<float> _Nor
glBufferData(GL_ARRAY_BUFFER, Vertices.size()*sizeof(float), Vertices.data(), GL_STATIC_DRAW);
GLERROR("GLEW: BufferFail1");
glGenBuffers(1, &NormalBuffer);
glBindBuffer(GL_ARRAY_BUFFER, NormalBuffer);
glBufferData(GL_ARRAY_BUFFER, Normals.size()*sizeof(float), Normals.data(), GL_STATIC_DRAW);
glGenBuffers(1, &Colorbuffer);
glBindBuffer(GL_ARRAY_BUFFER, Colorbuffer);
glBufferData(GL_ARRAY_BUFFER, Colors.size()*sizeof(float), Colors.data(), GL_STATIC_DRAW);
GLERROR("GLEW: BufferFail2");
glGenBuffers(1, &TextureCoordBuffer);
glBindBuffer(GL_ARRAY_BUFFER, TextureCoordBuffer);
glBufferData(GL_ARRAY_BUFFER, TextureCoords.size()*sizeof(float), TextureCoords.data(), GL_STATIC_DRAW);
GLERROR("GLEW: BufferFail3");
// glGenBuffers(1, &TextureCoordBuffer);
// glBindBuffer(GL_ARRAY_BUFFER, TextureCoordBuffer);
// glBufferData(GL_ARRAY_BUFFER, TextureCoords.size()*sizeof(float), TextureCoords.data(), GL_STATIC_DRAW);
// GLERROR("GLEW: BufferFail3");
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
@@ -53,15 +65,15 @@ void Model::CreateBuffers( std::vector<float> _Vertices, std::vector<float> _Nor
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
GLERROR("GLEW: BufferFail5");
glBindBuffer(GL_ARRAY_BUFFER, NormalBuffer);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, Colorbuffer);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, TextureCoordBuffer);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, 0);
// glBindBuffer(GL_ARRAY_BUFFER, TextureCoordBuffer);
// glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
/* glEnableVertexAttribArray(2);*/
GLERROR("GLEW: BufferFail5");
}