in ffi, enable GL_DEPTH_TEST and also clear the GL_DEPTH_BUFFER_BIT on each frame; I forgot this before, but it is essential for proper depth testing/layering
This commit is contained in:
@@ -65,13 +65,13 @@ struct
|
|||||||
Rect.lerp
|
Rect.lerp
|
||||||
( Real32.fromInt (posX - 1)
|
( Real32.fromInt (posX - 1)
|
||||||
, Real32.fromInt posY
|
, Real32.fromInt posY
|
||||||
, 0.01
|
, 0.9
|
||||||
, scale
|
, scale
|
||||||
, fw
|
, fw
|
||||||
, fh
|
, fh
|
||||||
, r
|
, 1.0
|
||||||
, g
|
, 1.0
|
||||||
, b
|
, 1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
fun makeChr (chr, posX, posY, windowWidth, windowHeight, r, g, b) =
|
fun makeChr (chr, posX, posY, windowWidth, windowHeight, r, g, b) =
|
||||||
@@ -79,7 +79,7 @@ struct
|
|||||||
( chr
|
( chr
|
||||||
, Real32.fromInt posX
|
, Real32.fromInt posX
|
||||||
, Real32.fromInt posY
|
, Real32.fromInt posY
|
||||||
, 0.05
|
, 0.1
|
||||||
, scale
|
, scale
|
||||||
, windowWidth
|
, windowWidth
|
||||||
, windowHeight
|
, windowHeight
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ unsigned int DYNAMIC_DRAW = GL_DYNAMIC_DRAW;
|
|||||||
// OpenGL functions used below
|
// OpenGL functions used below
|
||||||
void loadGlad() {
|
void loadGlad() {
|
||||||
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport(int width, int height) {
|
void viewport(int width, int height) {
|
||||||
@@ -24,7 +25,7 @@ void clearColor(float r, float g, float b, float a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int createBuffer() {
|
unsigned int createBuffer() {
|
||||||
|
|||||||
Reference in New Issue
Block a user