--- /dev/null
+#include <GL/glew.h>
+#include <glm/ext.hpp>
+#include "shapes.hpp"
+#include "util.hpp"
+
+GLuint utilVao;
+Program *utilProg;
+
+Program *getUtilProg() { return utilProg; }
+
+void initUtilProg() {
+ utilProg = new Program("plainvertex.glsl", "plainfrag.glsl");
+
+ glGenVertexArrays(1, &utilVao);
+ GLuint vbo;
+ glBindVertexArray(utilVao);
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(pyramid), pyramid, GL_STATIC_DRAW);
+ GLuint posLoc = glGetAttribLocation(utilProg->progId, "vPosition");
+ glEnableVertexAttribArray(posLoc);
+ glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, 0, 0);
+
+ if (glGetError()) abort();
+}
+
+void drawDebugNode(glm::mat4 model, glm::vec4 color) {
+ GLint prevProg; glGetIntegerv(GL_CURRENT_PROGRAM, &prevProg);
+
+ glUseProgram(utilProg->progId);
+
+ glDepthRange(0, 0.01);
+
+ glBindVertexArray(utilVao);
+ model = glm::scale(model, {0.1, 0.3, 0.1});
+ GLuint modelLoc = glGetUniformLocation(utilProg->progId, "model");
+ glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
+
+ GLuint colorLoc = glGetUniformLocation(utilProg->progId, "color");
+ glUniform4fv(colorLoc, 1, glm::value_ptr(color));
+
+ glDrawArrays(GL_TRIANGLES, 0, 36);
+
+ glDepthRange(0, 1.f);
+
+ glUseProgram(prevProg);
+}