Skip to content

Instantly share code, notes, and snippets.

@thomasvanta
Created January 30, 2014 19:00
Show Gist options
  • Save thomasvanta/8716300 to your computer and use it in GitHub Desktop.
Save thomasvanta/8716300 to your computer and use it in GitHub Desktop.
OF: 2D Grid
textureRes = (int)sqrt((float)numParticles);
numParticles = textureRes * textureRes;
float * pos = new float[numParticles*3];
for (int x = 0; x < textureRes; x++){
for (int y = 0; y < textureRes; y++){
int i = textureRes * y + x;
pos[i*3 + 0] = ofMap(x + 1, 0, textureRes + 1, 0, 1); //x*offset;
pos[i*3 + 1] = ofMap(y + 1, 0, textureRes + 1, 0, 1); //y*offset;
pos[i*3 + 2] = 0.0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment