OpenGL is a great environment for developing portable, platform independent, interactive 2D and 3D graphics applications. The API implementation in Python is cumbersome, resulting in applications with high latency. To solve this problem we have developed ModernGL, a wrapper over OpenGL that simplifies the creation of simple graphics applications like scientific simulations, small games or user interfaces. Usually, acquiring in-depth knowledge of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to learn and use, moreover it is capable of rendering with the same performance and quality, with less code written.
ModernGL.Init()
prog = ModernGL.NewProgram([
ModernGL.NewVertexShader('''
#version 330 core
in vec2 vert;
void main() {
gl_Position = vec4(vert, 0.0, 1.0);
}
'''),
ModernGL.NewFragmentShader('''
#version 330 core
out vec4 color;
void main() {
color = vec4(0.2, 0.6, 0.9, 1.0);
}
'''),
])
vbo = ModernGL.NewVertexBuffer(struct.pack('6f', 0, 0, 1, 0, 0, 1))
vao = ModernGL.NewVertexArray(prog, vbo, '2f', ['vert'])
ModernGL.RenderTriangles(vao, 3)
pip install ModernGL
for Ubuntu:
apt-get install python3-dev
apt-get install libgl1-mesa-dev
pip3 install ModernGL
some examples depend on: PyQt5 and GLWindow
pip3 install PyQt5
pip install GLWindow
PyQt5 is platform independent. GLWindow is windows only.
Please follow the Examples or Tutorials.
Examples
Documentation
Questions
PyPI
Github Repository
Github Page
Github Docs
Use the builtin help()
for the latest docs.
The Documentation will be updated soon.
Please follow the Examples.
Checkout the OpenGL Registry for core specifications.
- tested on Ubuntu 16.04
- tested on Windows 7
- tested on Windows 10