L-System

data types:

ofVbo ptsVbo;
ofVec3f pts[NUM_PTS];
ofFloatColor color[NUM_PTS];

loading the data

ptsVbo.setColorData(color, number_to_load_into_buffer, GL_DYNAMIC_DRAW);
ptsVbo.setVertexData(pts, number_to_load_into_buffer, GL_DYNAMIC_DRAW);

in the draw() function:

ofEnableAlphaBlending();
ptsVbo.draw(GL_TRIANGLE_STRIP, 0, number_to_load_into_buffer);
ofDisableAlphaBlending();

I vote for this last one to be added into a Made With openFrameworks. Really beautiful stuff!

openGL with 8xFSAA can perform small miracles

I appreciate the compliment!

the rest of my work can be found @ http://university-records.com

Hi, I tried downloading and running the code but on line 81 of LSys.cpp I get this error :
Variable length array of non-POD element type ‘string’ (aka ‘basic_string’)

Any idea?
Thanks

Found the solution,
replace : string substr[length];
with
vector substr(length);

maybe a complier issue? for me works fine in ubuntu 11.04 with codeblocks 10.05 and gcc 4.4 what are yours specs?

edit: you were speeder than me!

http://openprocessing.org/sketch/61273

TurtleGraphics/L-System based on the earlier work in this thread.

made with the above

Curious about this 3d L-systems extension. Unfortunately the download doesn’t work anymore. Is it still available somewhere?

If anyone is interested in what I made with the (original) L-system class some years ago, you can find some examples of the resulting project (for which I greatly extended the class) on my website: http://bardofrings.nl/portfolio/passiflora/index.html

Here some code that produces beautiful plants. I believe they are the nicest without using shaders or lights.
#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);
};

#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();

}
}

#include “ofMain.h”
#include “application.h”

int main( )
{
ofSetupOpenGL(512, 512, OF_WINDOW);
ofRunApp(new Application());
}