CS148: Computer Graphics
Generated using simple recursive algorithms for transformation in OpenGL
void fractal2D(double steps) {
if(steps > 20) set color brown:
else set color to a random green;
drawRectangle(-steps/20,0,steps/20,steps); // 1:20
glTranslated(0, steps, 0); // move to the top of the rectangle
if(steps > 2) {
glPushMatrix();
glRotatef(-RandInt(90), 0, 0, 1);
fractal2D(steps/2); // start first branch
glPopMatrix();
glRotatef(RandInt(90), 0, 0, 1);
fractal2D(steps/1.2); // start secound branch
}
}-
Comments:
Post a Comment

Patrick
Movies
TU Wien