X-Git-Url: http://git.mutantstargoat.com?p=demo;a=blobdiff_plain;f=src%2Fopengl%2Fopengl.cc;h=367e283686d5690451ecc6ff0dc9800f3683909f;hp=ffa1d47290cd5f677868aac51a44261751665fbd;hb=d1a2cf93cf54898bb4ad442da94fc61f2617cf9f;hpb=713e854b6daf2ec0de8538be1e1eb385a213f36c diff --git a/src/opengl/opengl.cc b/src/opengl/opengl.cc index ffa1d47..367e283 100644 --- a/src/opengl/opengl.cc +++ b/src/opengl/opengl.cc @@ -10,6 +10,8 @@ extern int win_w; static void clear(float r, float g, float b); static void viewport(int x, int y, int width, int height); +static void zbuffer(bool enable); +static void cull_face(Gfx_cull_face cf); bool init_opengl() { @@ -36,6 +38,8 @@ bool init_opengl() gfx_clear = clear; gfx_viewport = viewport; + gfx_zbuffer = zbuffer; + gfx_cull_face = cull_face; return true; } @@ -57,4 +61,29 @@ static void clear(float r, float g, float b) static void viewport(int x, int y, int width, int height) { glViewport(x, y, width, height); +} + +static void zbuffer(bool enable) +{ + if(enable) + glEnable(GL_DEPTH_TEST); + else + glDisable(GL_DEPTH_TEST); +} + +static void cull_face(Gfx_cull_face cf) +{ + switch(cf) { + case GFX_CULL_NONE: + glDisable(GL_CULL_FACE); + break; + case GFX_CULL_FRONT: + glEnable(GL_CULL_FACE); + glCullFace(GL_FRONT); + break; + case GFX_CULL_BACK: + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + break; + } } \ No newline at end of file