https://github.com/komodoresoft/mgl
OpenGL 1-style wrapper for Modern OpenGL in C
https://github.com/komodoresoft/mgl
c immediate-mode opengl wrapper
Last synced: about 2 months ago
JSON representation
OpenGL 1-style wrapper for Modern OpenGL in C
- Host: GitHub
- URL: https://github.com/komodoresoft/mgl
- Owner: komodoresoft
- License: apache-2.0
- Created: 2025-08-19T23:27:53.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-10-05T23:35:14.000Z (9 months ago)
- Last Synced: 2025-10-06T01:16:56.361Z (9 months ago)
- Topics: c, immediate-mode, opengl, wrapper
- Language: C
- Homepage:
- Size: 571 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📦 Modern Legacy GL (MGL)
**MGL** is an OpenGL 1-style wrapper for modern OpenGL functions, keeping an old-school, lightweight interface similar to legacy OpenGL. Perfect for small engines, retro-style games, or learning purposes.
   
## 📝 Example
This little snippet shows what the library allows you to do.
```c
mglMatrixMode(GL_PROJECTION);
mglLoadIdentity();
mgluPerspective(60.0, (float)width/(float)height, 0.1, 100.0);
mgluTranslatef(0.0, 0.0, -5.0);
mglMatrixMode(GL_MODELVIEW);
mglLoadIdentity();
mglBegin(GL_TRIANGLES);
mglColor3f(1.0, 0.0, 0.0); mglVertex2f( 0.0, -1.0);
mglColor3f(0.0, 1.0, 0.0); mglVertex2f(-0.5, 0.5);
mglColor3f(0.0, 0.0, 1.0); mglVertex2f( 0.5, 0.5);
mglEnd();
```
## ⚙️ Prerequisites
To compile and use MGL, you need to install the following prerequisites:
- C compiler (GCC, Clang, MSVC)
- OpenGL headers and libraries
- [The KMAK Build System](https://komodoresoft.com/kmak/)
## 📦 Installation
To install the library and use it in your projects, use the following commands:
```bash
git clone https://github.com/komodoresoft/mgl
cd mgl
kmak make.kmk init
kmak make.kmk build_mgl
```
## 🧩 Compiling the Examples
To compile the examples you need [glfw3](https://www.glfw.org/).
- Once you downloaded the glfw3, copy the headers in `include\GLFW`
- Then, place the compiled libraries in `lib`
- Next, place `glfw3.dll` in `examples`
- Finally, you can compile the examples with:
```bash
kmak make.kmk build_tests
```