From 99f2476d7bb8479d543f080c209324c77c775737 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:35:23 +1000 Subject: bring back gltf --- src/renderer/backends/opengl/backend_opengl.c | 7 ++++--- src/renderer/backends/opengl/backend_opengl.h | 4 ++++ src/renderer/backends/opengl/opengl_helpers.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/renderer/backends/opengl') diff --git a/src/renderer/backends/opengl/backend_opengl.c b/src/renderer/backends/opengl/backend_opengl.c index ba9435e..de6b71a 100644 --- a/src/renderer/backends/opengl/backend_opengl.c +++ b/src/renderer/backends/opengl/backend_opengl.c @@ -44,7 +44,7 @@ bool gpu_backend_init(const char* window_name, struct GLFWwindow* window) { resource_pools_init(&context.pool_arena, context.resource_pools); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); @@ -132,7 +132,7 @@ gpu_cmd_encoder gpu_cmd_encoder_create() { void gpu_cmd_encoder_destroy(gpu_cmd_encoder* encoder) {} void gpu_cmd_encoder_begin(gpu_cmd_encoder encoder) {} void gpu_cmd_encoder_begin_render(gpu_cmd_encoder* encoder, gpu_renderpass* renderpass) { - rgba clear_colour = STONE_900; + rgba clear_colour = STONE_800; glClearColor(clear_colour.r, clear_colour.g, clear_colour.b, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } @@ -181,7 +181,8 @@ void encode_bind_shader_data(gpu_cmd_encoder* encoder, u32 group, shader_data* d glBufferSubData(GL_UNIFORM_BUFFER, 0, ubo_buf->size, data->data); } else if (binding.type == SHADER_BINDING_TEXTURE) { gpu_texture* tex = TEXTURE_GET(binding.data.texture.handle); - glActiveTexture(GL_TEXTURE0 + i); + glActiveTexture(GL_TEXTURE0); + // glActiveTexture(GL_TEXTURE0 + i); glBindTexture(GL_TEXTURE_2D, tex->id); } } diff --git a/src/renderer/backends/opengl/backend_opengl.h b/src/renderer/backends/opengl/backend_opengl.h index 348eb41..f3b4eb7 100644 --- a/src/renderer/backends/opengl/backend_opengl.h +++ b/src/renderer/backends/opengl/backend_opengl.h @@ -45,6 +45,10 @@ typedef struct gpu_texture { void *pad } gpu_texture; +typedef struct opengl_support { + +} opengl_support; + u32 shader_create_separate(const char *vert_shader, const char *frag_shader); void uniform_vec3f(u32 program_id, const char *uniform_name, vec3 *value); diff --git a/src/renderer/backends/opengl/opengl_helpers.h b/src/renderer/backends/opengl/opengl_helpers.h index a3c4014..41018cb 100644 --- a/src/renderer/backends/opengl/opengl_helpers.h +++ b/src/renderer/backends/opengl/opengl_helpers.h @@ -43,6 +43,7 @@ static opengl_vertex_attr format_from_vertex_attr(vertex_attrib_type attr) { } static u32 opengl_bindcreate_vao(gpu_buffer* buf, vertex_description desc) { + DEBUG("Vertex format name %s", desc.debug_label); // 1. Bind the buffer glBindBuffer(GL_ARRAY_BUFFER, buf->id.vbo); // 2. Create new VAO -- cgit v1.2.3-70-g09d2