Skip to content

Sierpinski Carpet generation using OpenGL and GLUT toolkit.

Notifications You must be signed in to change notification settings

piotrdurniat/sierpinski-carpet-opengl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sierpinski Carpet in OpenGL

Sierpinski Carpet generation using OpenGL and GLUT library. Written in c++.

Images

Carpet generated by 6 iterations and width of 728 pixels:

Carpet by 6 iterations and width of 728 pixels

Generated by executing:

./bin/main --iterations 6 --width 728

Carpet with random color and deformations:

Carpet with random color and deformations set to 0.3

Generated by executing:

./bin/main --iterations 4 --deformation 0.3 --color

Compiling:

To compile the source code execute:

make

or:

g++ src/main.cpp -lGL -lglut -o bin/main

Usage:

To run the program execute:

./bin/main

Available parameters:

  • --size <size_in_px> sets the carpet width and height. The size_in_px value must be a power of 3 (default value: 728),
  • --iterations <num_of_iterations> sets the number of iterations ("the depth of the recursion tree") (default value: 6),
  • --color sets the color of inner cubes to random values,
  • --deformation <deformation_amount> randomly deforms the carpet. The deformation_amount must be a floating point number between 0.0 and 1.0. 0.0 means no deformation. 1.0 means that deformation can achieve a maximum value of one inner square (default value: 0.0)
  • --help prints help text.

About

Sierpinski Carpet generation using OpenGL and GLUT toolkit.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published