Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Rotating Squares on the grid

$
0
0

@Arza_Sajid wrote:

Hey guys, I have created a 2d grid of squares 5x5

I am trying to rotate the squares individually, the code i have so far is
ofSeedRandom(0);

ofSetRectMode(OF_RECTMODE_CENTER);

for(int i = 0; i < 5; i++){

for(int j=0; j<5; j++){

float r =(i+j+ofGetElapsedTimef())*60;

    glPushMatrix();
    glTranslatef(ofGetWindowWidth()/3,ofGetWindowHeight()/3,0);
    glRotatef(r/10,1,1,1);
    ofSetColor(colors[i].r, colors[i].g, colors[i].b);
    ofRect(i*80, j*80, 60,60);
    glPopMatrix();

this rotates the whole grid not the squares individually, any help would be apperciated.

thanks!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles