Forgot to actually compile the shader :P

This commit is contained in:
NaifBanana 2026-06-26 09:50:10 -05:00
parent 2c4392a51e
commit 75bda91302
2 changed files with 12 additions and 2 deletions

View File

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

View File

@ -5,7 +5,7 @@
int main() { int main() {
nb::logger.log("Howdy!"); 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_MAJOR, 3);
window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
window.init(); window.init();
@ -56,6 +56,10 @@ int main() {
GLFWwindow* window_ptr = window.getWindow(); GLFWwindow* window_ptr = window.getWindow();
while(!glfwWindowShouldClose(window_ptr)) { while(!glfwWindowShouldClose(window_ptr)) {
glDrawArrays(GL_TRIANGLES, 0, 3); 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; return 0;