summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/daw.c10
-rw-r--r--src/platform_glfw.c4
-rw-r--r--src/rendering.c7
3 files changed, 11 insertions, 10 deletions
diff --git a/src/daw.c b/src/daw.c
index eb85a64..79b230c 100644
--- a/src/daw.c
+++ b/src/daw.c
@@ -251,11 +251,11 @@ i32 engine_run(Instance* p, StateType initial_state, void* state_arg) {
BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_RGB8),
// The depth buffer could also be a texture like so:
- BUFFERPARAMETER_SET_PARAMETER(
- BUFFERPARAMETER_SET_TYPE(0, BufferType_texture),
- BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_DEPTH32
- ),
- //BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_RENDERBUFFER_DEPTH | BUFFERPARAMETER_FMT_DEPTH32F),
+ // BUFFERPARAMETER_SET_PARAMETER(
+ // BUFFERPARAMETER_SET_TYPE(0, BufferType_texture),
+ // BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_DEPTH32
+ // ),
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_RENDERBUFFER_DEPTH | BUFFERPARAMETER_FMT_DEPTH32F),
};
FramebufferParameters p[] = {
{.num_attached_buffers = sizeof(t) / sizeof(t[0]), .dimensions = {wsz[0], wsz[1], 0}},
diff --git a/src/platform_glfw.c b/src/platform_glfw.c
index 9b71516..394695d 100644
--- a/src/platform_glfw.c
+++ b/src/platform_glfw.c
@@ -220,8 +220,8 @@ static void render_init_opengl(Window *restrict w, const u32 flags) {
ctx->Enable(GL_CULL_FACE);
ctx->CullFace(GL_BACK);
- ctx->Enable(GL_DEPTH_TEST);
- ctx->DepthFunc(GL_LESS);
+ //ctx->Enable(GL_DEPTH_TEST);
+ //ctx->DepthFunc(GL_LESS);
w->context = ctx;
w->renderer = WINDOW_RENDERER_OPENGL;
diff --git a/src/rendering.c b/src/rendering.c
index ac7b766..02be7d1 100644
--- a/src/rendering.c
+++ b/src/rendering.c
@@ -435,7 +435,7 @@ void render_begin(Window* w) {
glfwMakeContextCurrent(w->window);
((GladGLContext*)w->context)->BindFramebuffer(GL_FRAMEBUFFER, 0);
((GladGLContext*)w->context)->ClearColor(1.f, 0.f, 1.f, 1.f);
- ((GladGLContext*)w->context)->Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ ((GladGLContext*)w->context)->Clear(GL_COLOR_BUFFER_BIT);
}
void r_clear_buffer(void *restrict context, RenderTargets *restrict t, u32 framebuffer_idx) {
@@ -446,7 +446,8 @@ void r_clear_buffer(void *restrict context, RenderTargets *restrict t, u32 frame
void render_present(Window* w, RenderObject *restrict default_quad) {
const GladGLContext *restrict gl = w->context;
- gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
+ gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+ gl->Disable(GL_DEPTH_TEST);
gl->UseProgram(default_quad->shader.program);
gl->BindTextureUnit(0, default_quad->texture);
gl->BindVertexArray(default_quad->vao);
@@ -549,7 +550,7 @@ void r_draw_model(void *restrict context, RenderTargets *restrict t, u32 framebu
Camera c = *t->cam[framebuffer_idx];
gl->BindFramebuffer(GL_FRAMEBUFFER, t->framebuffer[framebuffer_idx]);
gl->Enable(GL_DEPTH_TEST);
- gl->DepthFunc(GL_LESS);
+ gl->DepthFunc(GL_LEQUAL);
//const f32 s = pos[3];
mat4 view; // view