diff --git a/examples/dev_testing/src/main.cpp b/examples/dev_testing/src/main.cpp index ae5a752..3cb299f 100644 --- a/examples/dev_testing/src/main.cpp +++ b/examples/dev_testing/src/main.cpp @@ -46,24 +46,20 @@ int main(int argc, char *argv[]) { glm::vec3(0.5f, -0.5f, 0.f), glm::vec3(0.f, 0.5f, 0.f), }; */ - /* std::vector vertices = { + std::vector vertices = { glm::vec3(0.5f, 0.5f, 0.0f), glm::vec3(0.5f, -0.5f, 0.0f), glm::vec3(-0.5f, 0.5f, 0.0f), + + glm::vec3(0.5f, -0.5f, 0.0f), + glm::vec3(-0.5f, -0.5f, 0.0f), + glm::vec3(-0.5f, 0.5f, 0.0f), }; std::shared_ptr tri(new simpleengine::shapes_2d::Triangle(base_shader_program, vertices)); - game.add_event(tri); */ + game.add_event(tri); - /* 0.5f, 0.5f, 0.0f, // top right - 0.5f, -0.5f, 0.0f, // bottom right - -0.5f, 0.5f, 0.0f, // top left - // second triangle - 0.5f, -0.5f, 0.0f, // bottom right - -0.5f, -0.5f, 0.0f, // bottom left - -0.5f, 0.5f, 0.0f */ - - std::vector vertices = { + /* std::vector vertices = { glm::vec3(0.5f, 0.5f, 0.f), // top right glm::vec3(0.5f, -0.5f, 0.f), // bottom right glm::vec3(-0.5f, -0.5f, 0.f), // bottom left @@ -76,7 +72,7 @@ int main(int argc, char *argv[]) { }; std::shared_ptr square(new simpleengine::shapes_2d::Square(base_shader_program, vertices, indicies)); - game.add_event(square); + game.add_event(square); */ return game.run(); } \ No newline at end of file diff --git a/include/simpleengine/shapes/2d/triangle.h b/include/simpleengine/shapes/2d/triangle.h index 8a71dac..0a1a605 100644 --- a/include/simpleengine/shapes/2d/triangle.h +++ b/include/simpleengine/shapes/2d/triangle.h @@ -39,7 +39,7 @@ namespace simpleengine::shapes_2d { vao.bind(); vbo.buffer(vertices.data(), 0, vertices.size() * sizeof(float) * 3); // 3 floats are in each "row" of the vector. - vao.enable_attrib(vbo, 0, vertices.size(), GL_FLOAT, 3 * sizeof(float), 0); + vao.enable_attrib(vbo, 0, 3, GL_FLOAT, 3 * sizeof(float), 0); } virtual ~Triangle() = default; @@ -52,7 +52,7 @@ namespace simpleengine::shapes_2d { glUseProgram(*shader_program); vao.bind(); - glDrawArrays(GL_TRIANGLES, 0, 3); + glDrawArrays(GL_TRIANGLES, 0, vertices.size()); } }; }