mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-15 07:48:15 +00:00
Improved 2D-3D drawing
Depth test disabled for 2D and only used on 3D; consequently LINES vs TRIANGLES vs QUADS buffers drawing order maters... but blending also works ok.
This commit is contained in:
@@ -643,6 +643,8 @@ void Begin3dMode(Camera camera)
|
||||
// Setup Camera view
|
||||
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
|
||||
rlMultMatrixf(MatrixToFloat(matView)); // Multiply MODELVIEW matrix by view matrix (camera)
|
||||
|
||||
rlEnableDepthTest(); // Enable DEPTH_TEST for 3D
|
||||
}
|
||||
|
||||
// Ends 3D mode and returns to default 2D orthographic mode
|
||||
@@ -657,6 +659,8 @@ void End3dMode(void)
|
||||
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||
|
||||
//rlTranslatef(0.375, 0.375, 0); // HACK to ensure pixel-perfect drawing on OpenGL (after exiting 3D mode)
|
||||
|
||||
rlDisableDepthTest(); // Disable DEPTH_TEST for 2D
|
||||
}
|
||||
|
||||
// Set target FPS for the game
|
||||
|
Reference in New Issue
Block a user