EAGL.Examples.LearnOpenGL.GettingStarted.CoordinateSystemsDepth (eagl v0.8.0)
View SourceLearnOpenGL 6.2 - Coordinate Systems (Depth)
This example demonstrates depth testing and Z-buffer concepts. It SOLVES the visual artifacts shown in example 6.1 by properly enabling depth testing for correct 3D rendering.
Key Difference from 6.1: This example enables depth testing, eliminating the face ordering problems you saw in 6.1 where back faces appeared in front of front faces.
Original C++ Source
This example is based on the original LearnOpenGL C++ tutorial: https://github.com/JoeyDeVries/LearnOpenGL/tree/master/src/1.getting_started/6.2.coordinate_systems_depth
Framework Adaptation Notes
This example demonstrates:
- Depth testing enabled for proper 3D rendering
- Z-buffer clearing each frame for correct depth comparisons
- Multiple objects at different depths to show depth sorting
- Overlapping geometry to emphasize depth testing importance
Key Learning Points
- Depth Testing: Understanding how the Z-buffer works
- Depth Buffer: Clearing and using the depth buffer
- Z-Fighting: What happens when depths are too close
- Depth Function: How OpenGL compares depth values
- 3D Visualization: Proper rendering of overlapping 3D objects
Visual Effect
Shows two overlapping cubes at different depths:
- One cube closer to the camera
- One cube further from the camera
- Demonstrates proper depth sorting with Z-buffer
Usage
EAGL.Examples.LearnOpenGL.GettingStarted.CoordinateSystemsDepth.run_example()
Press ENTER to exit.