Tag: tree

Python Stochastic 2D OpenGL Cutted Fractal Tree

My objective is create a 3D OpenGL Fractal Tree, but I’m just starting to learn OpenGL, so first thing I did was porting the code from Python Pygame primitives to python 2D OpenGL.   from OpenGL.GL import * from OpenGL.GLU

Posted in OpenGL, Programming, Python Tagged with: , , , , ,

2D Stochastic Cutted Fractal Tree with Pygame

import pygame, math, random pygame.init() window = pygame.display.set_mode((800, 800)) pygame.display.set_caption(“Stochastic Cutted Fractal Tree”) screen = pygame.display.get_surface() def drawTree(x1, y1, angle, depth, r,g,b): if depth: # Brown to green gradient g=g+7; if g>255: g=7 x2 = x1 + int(math.cos(math.radians(angle)) * random.randint(10,30))

Posted in Maths, Programming, Python Tagged with: , , , ,
%d bloggers like this: