From 0c2c626fbdfd7836f086eb8f4039a394368b7974 Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Thu, 23 Feb 2017 10:31:44 -0500 Subject: implemented depth testing and disabled blending for now --- example/main | Bin 49488 -> 49568 bytes example/main.cpp | 1 + example/main.o | Bin 4752 -> 4824 bytes glgfx.cpp | 10 ++++++++-- glgfx.h | 1 + glgfx.o | Bin 57920 -> 58104 bytes libglgfx.a | Bin 62084 -> 62288 bytes 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/example/main b/example/main index e4895a1..51bb73a 100755 Binary files a/example/main and b/example/main differ diff --git a/example/main.cpp b/example/main.cpp index 05777a4..d71322b 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -17,6 +17,7 @@ int main (int argc, char * argv[]) { loop = 1; while(loop) { cleargfx(); + clearglgfx(); //polls events, which are in a buffer //returns 1 if there is event in buffer //returns 0 if buffer is empty diff --git a/example/main.o b/example/main.o index 37c8220..adf6955 100644 Binary files a/example/main.o and b/example/main.o differ diff --git a/glgfx.cpp b/glgfx.cpp index 4dd25ec..9393d66 100644 --- a/glgfx.cpp +++ b/glgfx.cpp @@ -28,13 +28,15 @@ int initglgfx() { //for you glewExperimental = GL_TRUE; glewInit(); - glEnable (GL_BLEND); + //glEnable (GL_BLEND); // so we can have transparent polygons - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //culls back face triagnles, which is determined by whether vertexes are clockwise // or counterclockwise glEnable(GL_CULL_FACE); glCullFace(GL_BACK); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); GLuint glnum; glGenBuffers(1, &glnum); printf("%u\n",glnum); @@ -251,3 +253,7 @@ int drawmodel(float x, float y, float z, float xr, float yr, float zr) { } int quitglgfx() { } +int clearglgfx() { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + return 0; +} diff --git a/glgfx.h b/glgfx.h index 0cb1ff9..eccb33b 100644 --- a/glgfx.h +++ b/glgfx.h @@ -14,5 +14,6 @@ int drawmodel(float x, float y, float z, float xr, float yr, float zr); int setcam (float cpx, float cpy, float cpz, float clx, float cly, float clz, float cux, float cuy, float cuz); int setlight (float x, float y, float z); int quitglgfx(); +int clearglgfx(); std::string readfile(const char *); #endif diff --git a/glgfx.o b/glgfx.o index 292e2d8..db4367d 100644 Binary files a/glgfx.o and b/glgfx.o differ diff --git a/libglgfx.a b/libglgfx.a index 94ff8f8..bad183b 100644 Binary files a/libglgfx.a and b/libglgfx.a differ -- cgit v1.1