So instead of a texture, I used openGL (which I hear is probably faster than drawing a texture). This draws a square with 4 different colors in each corner that fade between them. I think in OF 007 there’s functions for the color/vertices calls using ofVbo, but I’m not on 007 yet.
unsigned long last;
int counter;
ofColor col;
ofColor col2;
ofColor col3;
ofColor col4;
void setup(){
last = ofGetElapsedTimeMillis();
col.setHsb(0,255,255);
col2.setHsb(0,255,255);
col3.setHsb(0,255,255);
col4.setHsb(0,255,255);
counter = 0;
};
void update(){
if(ofGetElapsedTimeMillis() - last > 50){
col.setHue(counter % 256);
col2.setHue((counter + 60) % 256);
col3.setHue((counter + 120) % 256);
col4.setHue((counter + 180) % 256);
counter += 1;
last = ofGetElapsedTimeMillis();
}
};
void draw(){
//the points to draw 2 - fullscreen rectangle
const GLfloat vertices[] = {
0, 0,
ofGetWidth(), 0,
0, ofGetHeight(),
ofGetWidth(), ofGetHeight(),
};
//the colors to map to the vertices
const GLubyte colors[] = {
col.r, col.g, col.b, 120,
col2.r, col2.g, col2.b, 120,
col3.r, col3.g, col3.b, 120,
col4.r, col4.g, col4.b, 120,
};
//draw the vertices with color
glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
//reset
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}