
Explore fast, interactive 2D generative visuals with ModernGL and NumPy, from sandpile simulations to orbital patterns, using basic Python knowledge.
Explore dynamic typing in Python and the core data types integers, floats, and strings; print values, check types, and convert between int, float, and string.
Explore lists and ranges in Python by learning to create, print types, sort with reverse, index and slice lists, append items, and work with nested and two-dimensional lists.
Explore for and while loops in Python by iterating over lists and ranges. Use enumeration and indexing to modify lists, and control repetition with a counter.
Master Python if statements with examples: use a for loop on a list, apply elif and else, check greater than 20, and test divisibility by seven or 13 with f-strings.
Explore how functions work as tiny machines that process input and return output, using def, return, and examples of doubling numbers, greetings, and discounts to reduce repetition and improve readability.
Learn how to import code from other files in Python, how imports run code, and why the Windows if __name__ == '__main__' guard matters.
Solve math problems with pure python using basics like variables, conditions, and loops. Tackle three exercises on divisors, fibonacci threshold, and moving zeros to end to build fluency.
Explore building a divisors function to find and print proper divisors, using integer division // to check up to n//2, with examples 1,2,3,4,6 and 248.
Explore a Fibonacci threshold search to find the last Fibonacci number below a threshold, using an iterative loop and break; recursion is optional but depth-limited.
Move zeros to the end of an array by separating non-zero and zero elements, print original and modified arrays using f-strings, then return non_zero plus zero_elements.
Demonstrate manual matrix multiplication and then show how converting a list of lists to numpy arrays enables faster, more usable math for the modern GL backend.
Explore NumPy basics: install and import NumPy, create and reshape arrays, apply masks, use broadcasting, view transpose, and work with zeros and ones, random values, and pi-based trig functions.
Compare numpy speed with plain python lists by adding large arrays element-wise, revealing numpy's speed advantage. Show CuPy, a GPU-based numpy clone, may beat numpy on arrays but adds overhead.
Model a bank account as a Python class to illustrate OOP concepts like the init method, self, and attributes such as owner, balance, and interest rate.
Build a fully functional bank account class with deposit, withdraw, interest, and transfer methods to manage per-object data. Explore error handling for positive amounts and safe transfers.
Create a car class to explore object oriented programming, using dunder methods like __init__ and __repr__ to display brand, horsepower, price, and model year, and sort by horsepower.
Explore how OpenGL powers GPU rendering as a low level standard. See how modern GL wraps OpenGL in Python, offering a clean, pythonic interface that simplifies shaders and GPU data.
Write vertex and fragment shaders in GLSL, create vertices in Python, and load them into VBOs and VAOs to render. The pipeline handles rasterization, fragment shading, blending, and frame buffers.
Install modern GL and modern GL window, set OpenGL to 3.3, and enable vsync, program point size, and blending to support rendering in a window.
Explore vertex shaders and how OpenGL uses normalized coordinates from -1 to 1 to map screen space for rendering shapes in a two-dimensional generative art and maths course.
Discover fragment shaders, including how to declare a color output and use vec2, vec3, and vec4. Learn about a c-like main function and basic conditional logic to color each pixel.
Create and render square cells on a grid by initializing parameters, preparing numpy arrays, compiling shaders, and updating buffers to handle movement and wall reflections.
Learn how a vertex shader defines a square cell in opengl glsl 330, using inputs, a resolution uniform, and passing color data to the fragment shader.
A correction.
Render ten square cell instances with a fragment shader and a single frag color output, using a vertex shader, while leveraging GPU parallelism and controlling point size in pixel space.
Create and animate square cell objects in python using modern GL window config, numpy random positions, and render them as points with color blending to show transitions and size changes.
Create a circle class in modern gl using CuPy, with configurable thickness to render hollow or solid circles, and implement vertex and fragment shaders plus buffer and vao management.
Explore the vertex shader for rendering a circle, using center x, center y, radius, color r, and thickness, with a resolution uniform and 2d point size calculations.
Learn to implement a circle in modern GL using a fragment shader, handling solid and hollow circles by computing pixel distance, clipping with radius and thickness, and discarding nonconforming fragments.
Explore circle animation in modern GL with 2D generative Python: render thousands of circles as points, implement collisions, boundary handling, blending, and performance tuning.
Explore modern gl line rendering in python using numpy, defining a line by start and end points, color, thickness, and resolution, with vertex and fragment shaders and shader program setup.
Construct a 2d vertex shader with uniforms for frag colors and thickness, define start and end positions, and set gl position at the center using resolution.
Explore rendering thick lines in a fragment shader for modern GL by projecting a point onto a line, computing distance, and discarding fragments outside the thickness.
Master line animation in modern OpenGL by configuring a window, enabling program point size and blending, and rendering 100 lines with vertex and fragment shaders.
Explore how a two-dimensional sandpile simulation topples grains on a grid, converting to a one-dimensional representation, handling edges, and visualizing emergent patterns in pixel space and normalized space.
Initialize a sandpile simulation class with a numpy f4 grid. Set the resolution and size, build a color bucket, and compute x and y positions with meshgrid before flattening.
Part two refines the sandpile by masking and zeroing edge cells, normalizing side and cell positions with the resolution, and creating dummy colors for the square cell.
Iterate a sandpile simulation by locating cells with at least four grains, distributing one grain to each neighbor using numpy broadcasting, updating masks and colors for a barebones render.
Master part four of a sandpile simulation in 2d generative python with primitive moderngl, importing sandpile, updating buffers, and rendering a grid of cells to visualize emergent patterns.
Explore how orbital patterns are created in 2d generative python, building lissajous models with differing angular velocities and drawing the line between two orbiting objects to visualize the motion.
Explore an orbital pattern simulation by building a planet class and circle objects, using vertex and fragment shaders, rotation matrices, and buffer updates to render rotating planets around a star.
Explore orbital patterns by simulating two planets orbiting a star, drawing 500 trajectory lines, and visualizing color-mapped paths with numpy and ModernGL.
explore orbital pattern simulation in 2d generative python by adjusting angular velocity and line counts, rendering brighter light objects with float32 arrays, and experimenting with multiple orbiting planets.
Welcome to Generative Python: Arts and Maths with ModernGL. This course is designed for curious minds who want to bridge the gap between programming, mathematics, and visual creativity using Python and GPU-accelerated graphics.
We'll start from the absolute basics of Python—variables, loops, functions—and gradually move toward advanced topics like NumPy, object-oriented programming, and GPU rendering with ModernGL. Each section is filled with practical, project-driven exercises designed to help you learn by doing, not just watching.
You’ll build visually stunning and mathematically rich projects, such as sandpile simulations, Fourier drawing, and Perlin noise-generated continents—all while developing a solid understanding of shaders and real-time graphics.
This course is ideal for beginners with a basic grasp of Python or complete newcomers ready to explore coding through art and science. Whether you're a student, a hobbyist, or a developer looking to expand your creative skill set, this course will provide the tools and knowledge to bring your ideas to life on the screen.
No prior experience with graphics programming is required. You'll learn step-by-step, and by the end of the course, you'll be able to create your own GPU-powered visual simulations with confidence. I hope you will enjoy your stay and learn some ModernGL along the way!