Hello.
I have a problem with ofSetBackgroundAuto().
I attached simple code to simulate the problem.
If I set ofSetBackgroundAuto() false, OF doesn’t draw from the top.
It looks like it skips 3 or 4 frames.
But it draws OK with true.
testApp.h
#include "ofMain.h"
using namespace std;
class CA
{
private:
int cellSize;
public:
int* mCells;
int mGeneration;
int mInterval;
int aa;
CA()
{
mInterval = 10;
cellSize = ofGetWidth()/mInterval;
mCells = new int[cellSize];
mGeneration = 0;
for(int i=0; i<cellSize; i++)
{
mCells[i] = i%2;
}
}
void Generate()
{
aa++;
for(int i=0; i<cellSize; i++)
{
mCells[i] = (i+aa)%2;
}
mGeneration++;
}
void Display()
{
for(int i=0; i<cellSize; i++)
{
if(mCells[i]==0)
{
ofSetColor(255);
}
else
{
ofSetColor(0);
}
ofRect(i*mInterval, mGeneration*mInterval, mInterval, mInterval);
}
}
};
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
double w,h;
CA ca;
};
testApp.cpp
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofSetFrameRate(1);
//try ofSetBackgroundAuto true and false
ofSetBackgroundAuto(false);
w = ofGetWidth();
h = ofGetHeight();
ofBackground(255);
}
//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
void testApp::draw(){
if(ca.mGeneration < h/ca.mInterval)
{
ca.Display();
ca.Generate();
}
}