A repository dedicated to learning the fundamentals of graphics programming from the ground up. This project uses the Odin programming language and modern graphics APIs to explore core concepts, starting with simple shapes and progressing to a basic rendering engine.
This project serves as a hands-on guide to understanding the principles of computer graphics. It is structured as a series of lessons, each building upon the last, to incrementally introduce new techniques and concepts. The primary goal is to demystify the graphics pipeline by implementing various features manually, leading to the development of a small, reusable rendering engine.
Technologies Used:
The lessons within the src directory cover the following fundamental topics:
- Basic Drawing: Rendering your first triangle.
- Shapes: Creating more complex shapes like squares.
- Index Buffers: Efficiently drawing objects by reusing vertices.
- Uniforms: Passing data from the CPU to shaders.
- Textures: Applying 2D images to surfaces.
- Blending: Implementing transparency and alpha blending.
- MVP Transformations: Understanding Model-View-Projection matrices for 3D space.
- Multiple Objects: Rendering a scene with several distinct objects.
- Batch Rendering: An optimization technique for drawing many similar objects efficiently.
Before you begin, ensure you have the following installed on your system:
- Odin Compiler: The project is written in Odin.
- Make: For running the build scripts.
- A C Compiler: (e.g., GCC or Clang) for linking dependencies.
- OpenGL-compatible Graphics Driver: Required for rendering.
- GLFW and GLEW/GLAD: Or equivalent libraries for window creation and OpenGL function loading. The
Makefileshould handle local dependencies.
You can compile and run any of the lessons using the provided Makefile.
To run a specific lesson, navigate to the project root and use the make run command with the lesson number. For example, to run the 01_triangle example:
make run LESSON=01_triangleTo run the main application which uses the developed engine:
make run LESSON=mainThe repository is organized as follows:
.
├── Learn_Vulkan/ # (Future Work) Exploration of the Vulkan API
├── Makefile # Build script for compiling and running lessons
├── shaders/ # GLSL shader files for vertex and fragment processing
├── src/ # Source code for all lessons and the rendering engine
│ ├── 01_triangle.odin # Individual lessons
│ ├── ...
│ └── Engine/ # Core components of the rendering engine
└── textures/ # Image files used for texturing
As the lessons progress, a small rendering engine is developed with the following components located in src/Engine/:
- Renderer: A high-level structure that encapsulates rendering logic.
- VertexBuffer & IndexBuffer: Abstractions for managing vertex and index data on the GPU.
- VertexArray: Represents the state of vertex buffers and their layouts.
- VertexBufferLayout: Defines the structure of vertex data (e.g., position, color, texture coordinates).
- Shader: A helper for loading, compiling, and managing GLSL shader programs.
- Texture: A structure for loading and binding texture images.
- Debugger: Provides utility functions for debugging and error checking.
Contact