Here my code using Openframework. I believe it produces the most light weight and beautiful many L-systems plants in a loop and not using any light or texture.
#include "ofMain.h"
#include "application.h"
int main( )
{
ofSetupOpenGL(512, 512, OF_WINDOW);
ofRunApp(new Application());
}
--------------------------
#include "renderer.h"
void Renderer::setup()
{
ofSetFrameRate(3);
ofSetWindowShape(kWindow_width, kWindow_height);
}
void Renderer::draw()
{
ofFill();
ofSetLineWidth(10);
ofClear(0);
ofScale(1.0f, -1.0f);
ofTranslate(kWindow_width / 2, -kWindow_height + 75);
ofLine(0,0,0, 300);
angleDepart -= 1;
splitLine(0, 300, 20, angleDepart); // faire varier le 20, en 10 et 20, c'est le plus intéressant
}
void Renderer::splitLine(int iX, int iY, int iThickness, float iAngle)
{
if (iThickness - 1 > 0)
{
ofPushMatrix();
ofTranslate(iX, iY);
ofRotateZ(iAngle);
ofSetLineWidth(iThickness - 1);
ofLine(0, 0, iX * 0.75, iY * 0.75);
splitLine(iX * 0.75, iY * 0.75, iThickness - 1, iAngle);
ofPopMatrix();
ofPushMatrix();
ofLine(0, 0, iX * 0.75, iY * 0.75);
ofSetColor(65, ofRandom(255), 0);
splitLine(iX * 0.75, iY * 0.75, iThickness - 2, -iAngle);
ofPopMatrix();
}
}
----------------------------------
#pragma once
#include "ofMain.h"
class Renderer
{
public:
void setup();
void draw();
int angleDepart = 0;
const int kWindow_height = 1000;
const int kWindow_width = 1200;
void splitLine(int iX, int iY, int iThickness, float angle);
};
L-System picture