Here is how that error shows up in the code I was trying to use:
I am using
OpenFrameworks and
ofxPostProcessing. The postprocessing stuff basically just wraps some shaders and abstracts their use in OpenFrameworks.
The problem happens in an ofxPostProcessing class that extends an abstract class from OpenFrameworks. PostProcessing extends ofBaseDraws defined in
ofBaseTypes.h.
c++ code:
class ofBaseDraws{
public:
virtual ~ofBaseDraws(){}
virtual void draw(float x, float y)=0;
virtual void draw(float x, float y, float w, float h)=0;
virtual void draw(const ofPoint & point) {
draw(point.x, point.y);
}
virtual void draw(const ofRectangle & rect) {
draw(rect.x, rect.y, rect.width, rect.height);
}
virtual void draw(const ofPoint & point, float w, float h) {
draw(point.x, point.y, w, h);
}
virtual float getHeight()=0;
virtual float getWidth()=0;
virtual void setAnchorPercent(float xPct, float yPct){};
virtual void setAnchorPoint(float x, float y){};
virtual void resetAnchor(){};
};
PostProcessing.h
PostProcessing.cpp
These are supposed to be the implementations of the abstract methods in ofBaseDraws. I don't know if the presence or lack of a const qualifier is part of the function signature. There is not a const qualifier on the abstract class method defintions. Taking the const qualifier off the PostProcessing stuff allows it to build.
c++ code:
// float rather than int and not const to override ofBaseDraws
void draw(float x = 0.f, float y = 0.f) const;
void draw(float x, float y, float w, float h) const;
float getWidth() const { return width; }
float getHeight() const { return height; }
Here is where the compiler flags the error where draw is called on the frame buffer reference raw and the other draw call on the ping pong frame buffer.
c++ code:
void PostProcessing::draw(float x, float y, float w, float h) const
{
if (flip)
{
glPushMatrix();
glTranslatef(x, y + h, 0);
glScalef(1, -1, 1);
}
else glTranslatef(x, y, 0);
if (numProcessedPasses == 0) raw.draw(0, 0, w, h);
else pingPong[currentReadFbo].draw(0, 0, w, h);
if (flip) glPopMatrix();
}