added debug code to find 'black screen of death'
This commit is contained in:
parent
a53db41bab
commit
455177d33e
3 changed files with 24 additions and 7 deletions
|
@ -60,9 +60,6 @@ void geometry::set_vertices(const geometry::vertex3array_t &v)
|
|||
// first set vertices
|
||||
_vertices = v;
|
||||
|
||||
//
|
||||
compute_normals();
|
||||
|
||||
// update bounds
|
||||
compute_bounds();
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ struct triangle_renderer
|
|||
matrix4x4f view_mat = matrix_transform<float>::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<float>::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);
|
||||
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
|
||||
#include "pw/core/mesh.hpp"
|
||||
#include "pw/core/size.hpp"
|
||||
#include "pw/core/debug.hpp"
|
||||
|
||||
#include "glad/glad.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
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::)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue