I started off by following the tutorials at Hello Cinder except they turned out to be slightly outdated. In the samples there is also a Particles project but it had way more complicated things like perlin noise
I took both concepts and wrote this
#include <cinder/app/App.h>
#include <cinder/app/RendererGl.h>
#include <cinder/Rand.h>
#include <cinder/gl/draw.h>
#include <cinder/gl/wrapper.h>
using namespace ci;
using namespace ci::app;
#define NUM_PARTICLES 50
class Particle {
public:
vec2 mPosition = randVec2();
vec2 mVelocity = randVec2();
vec2 mDirection = randVec2();
void update()
{
mPosition = mDirection * mVelocity;
}
void draw()
{
gl::drawSolidCircle(mPosition, 10.0f);
}
};
class BasicApp : public App {
public:
void setup() override;
void update() override;
void draw() override;
void resize() override;
std::vector<Particle> mParticles;
};
void prepareSettings( BasicApp::Settings* settings )
{
settings->setWindowSize(1000,700);
settings->setTitle("BasicApp");
}
void BasicApp::setup()
{
mParticles.reserve( NUM_PARTICLES );
}
void BasicApp::resize()
{
gl::setMatricesWindow(getWindowSize());
}
void BasicApp::update()
{
for( auto &particle : mParticles )
{
particle.update();
}
}
void BasicApp::draw()
{
gl::clear();
for( auto &particle : mParticles )
{
particle.draw();
}
}
CINDER_APP( BasicApp, RendererGl, prepareSettings )
But the screen is just pure black
What am I doing wrong?