--- a/opengl.h Wed Nov 29 01:27:05 2023 +0100
+++ b/opengl.h Fri Dec 01 20:25:49 2023 +0100
@@ -17,6 +17,7 @@
#pragma once
+#include <iostream>
#include <string>
#include <stdexcept>
@@ -27,6 +28,8 @@
#include <glm/glm.hpp>
#include <glm/ext.hpp>
+#include "Shader.h"
+
inline
void quads(GLfloat tx, GLfloat ty, GLfloat x, GLfloat y, GLfloat z) {
glTexCoord2f(tx, ty);
@@ -34,7 +37,7 @@
}
inline
-void checkError(std::ostream* out) {
+void checkError(std::ostream* out = nullptr) {
GLenum code = glGetError();
if (code == GL_NO_ERROR) {
if (out) *out << "GL check: OK" << std::endl;
@@ -46,9 +49,9 @@
}
inline
-GLenum toShaderType(const std::string& fileName) {
- if (fileName.ends_with(".vert")) return GL_VERTEX_SHADER;
- else if (fileName.ends_with(".frag")) return GL_FRAGMENT_SHADER;
+Shader::Type toShaderType(const std::string& fileName) {
+ if (fileName.ends_with(".vert")) return Shader::Type::VERTEX;
+ else if (fileName.ends_with(".frag")) return Shader::Type::FRAGMENT;
else throw std::invalid_argument("Expecting *.vert or *.frag file");
}