Compare commits

..

2 Commits

Author SHA1 Message Date
NaifBanana
75bda91302 Forgot to actually compile the shader :P 2026-06-26 09:50:10 -05:00
NaifBanana
2c4392a51e Change invalid buffer binding to warning instead of error 2026-06-26 09:49:27 -05:00
3 changed files with 14 additions and 4 deletions

View File

@ -72,10 +72,10 @@ class Buffer : public OpenGLObject {
if (_id) {
glBindBuffer(Target, _id);
} else {
THROW(BufferError(
WARN(BufferError(
Codes::INVALID_BUFFER,
"w/ BufferType " + BufferTypes.at(Target)
));
), 0xFE);
}
}
virtual void unbind() const override { glBindBuffer(Target, 0); }

View File

@ -17,7 +17,13 @@ const ErrorCodeMap ProgramError::ErrorMessages = {
Shader::Shader(GLenum target_, const std::string& source_) : target(target_) {
declare();
const char* src_ptr= source_.data();
glShaderSource(_id, 1, &src_ptr, NULL);
glCompileShader(_id);
_success = status(GL_COMPILE_STATUS);
if (!_success) {
WARN(log(), 0x0FE);
}
}
Shader::Shader(Shader&& cpy) : target(cpy.target) {
@ -49,7 +55,7 @@ Program::Program(SharedVector<Shader> shaders_) {
glLinkProgram(_id);
_success = status(GL_LINK_STATUS);
if (!_success) {
WARN(log(), 0x01);
WARN(log(), 0x0FE);
}
}

View File

@ -5,7 +5,7 @@
int main() {
nb::logger.log("Howdy!");
nb::Window window(200, 200, "Hello!");
nb::Window window(400, 400, "Hello!");
window.setWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
window.init();
@ -56,6 +56,10 @@ int main() {
GLFWwindow* window_ptr = window.getWindow();
while(!glfwWindowShouldClose(window_ptr)) {
glDrawArrays(GL_TRIANGLES, 0, 3);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwPollEvents();
glfwSwapBuffers(window_ptr);
}
return 0;