Created
July 31, 2016 20:34
-
-
Save jvcleave/7ad83dde34acf30f7b7d4d2b1c847892 to your computer and use it in GitHub Desktop.
fbo checkerboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fbo.allocate(256, 256); | |
fbo.begin(); | |
ofClear(0); | |
int step = 16; | |
int numRows, numCols; | |
numRows = numCols = fbo.getWidth() / step; | |
ofColor color1 = ofColor::white; | |
ofColor color2= ofColor::black; | |
ofColor lastColor = color1; | |
for (int y = 0; y < numRows; y++) | |
{ | |
for (int x = 0; x < numCols; x++) | |
{ | |
ofSetColor(lastColor); | |
ofDrawRectangle(x * step, y * step, step, step); | |
if(lastColor == color1) | |
{ | |
lastColor = color2; | |
}else | |
{ | |
lastColor = color1; | |
} | |
if (x + 1 == numCols && x % 2 != 0) | |
{ | |
if(lastColor == color1) | |
{ | |
lastColor = color2; | |
}else | |
{ | |
lastColor = color1; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if 0
endif