diff --git a/src/core/src/mesh.cpp b/src/core/src/mesh.cpp index 137e71f..02b81a4 100644 --- a/src/core/src/mesh.cpp +++ b/src/core/src/mesh.cpp @@ -60,9 +60,6 @@ void geometry::set_vertices(const geometry::vertex3array_t &v) // first set vertices _vertices = v; - // - compute_normals(); - // update bounds compute_bounds(); } diff --git a/src/visual/src/pipeline.cpp b/src/visual/src/pipeline.cpp index c8ee0e5..487c1ef 100644 --- a/src/visual/src/pipeline.cpp +++ b/src/visual/src/pipeline.cpp @@ -145,6 +145,7 @@ struct triangle_renderer matrix4x4f view_mat = matrix_transform::look_at(vector3({0,0,0}), vector3::forward(), vector3::up()); + // materials should carry this #if 1 glEnable(GL_CULL_FACE); @@ -155,7 +156,6 @@ struct triangle_renderer // now bind textures - #if 1 auto proj_mat = matrix_transform::orthographic_projection(1.3,1.0, 0.2f,100.f); @@ -189,6 +189,11 @@ struct triangle_renderer amesh_renderer.draw(); + auto error = glGetError(); + if (error != GL_NO_ERROR){ + debug::e() << "GL error " << error; + } + // debug::d() << 100 * (timer::now() - t0) << "ms"; } }; @@ -290,8 +295,8 @@ void pipeline::impl::draw() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo_msaa); - // glClearColor(0,0,0,1); - // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +// glClearColor(1.0,0,0,1); +// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // glViewport(0,0,800,600); diff --git a/src/visual/src/vertex_array.cpp b/src/visual/src/vertex_array.cpp index 24afb19..b08c94a 100644 --- a/src/visual/src/vertex_array.cpp +++ b/src/visual/src/vertex_array.cpp @@ -2,11 +2,13 @@ #include "pw/core/mesh.hpp" #include "pw/core/size.hpp" +#include "pw/core/debug.hpp" #include "glad/glad.h" #include + namespace pw { struct vertex_array::impl { @@ -34,7 +36,7 @@ struct vertex_array::impl { void create(const geometry& m) { - // not sure ... + // reset if the renderer already in use if (ready()) { release(); } @@ -77,6 +79,14 @@ struct vertex_array::impl { // stop binding glBindVertexArray(0); + auto error = glGetError(); + if (error != GL_NO_ERROR) { + debug::e() << "GL error: " << error; + } + + debug::d() << "Vertices: " << m.vertices().size(); + debug::d() << "Indices " << m.indices().size(); + } @@ -95,6 +105,11 @@ struct vertex_array::impl { glDrawElements(GL_TRIANGLES, _mesh_elements, GL_UNSIGNED_INT, nullptr); glBindVertexArray(0); + auto error = glGetError(); + if (error != GL_NO_ERROR) { + debug::e() << "GL error: " << error; + } + } // GLint get_mode(vertex_array::)