Hi, I figured out calling ofFbo.getTexture().bind()/unbind() methods doesn’t bind the FBO’s texture correctly on iOS.
Here’s my simple test code.
in ofApp.h
ofFbo fbo;
ofMesh mesh;
in ofApp.cpp
//--------------------------------------------------------------
void ofApp::setup(){
ofDisableArbTex();
ofSetCircleResolution(50);
int fboWidth = ofGetWidth()/4;
int fboHeight = ofGetHeight()/4;
fbo.allocate(fboWidth, fboHeight, GL_RGB);
fbo.begin();
ofClear(255, 0, 0, 255);
ofSetColor(0, 255, 0);
ofDrawEllipse(fboWidth/2, fboHeight/2, fboWidth, fboHeight);
fbo.end();
mesh = ofMesh::plane(fboWidth, fboHeight);
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
fbo.draw(0, 0);
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
fbo.getTexture().bind();
mesh.draw();
fbo.getTexture().unbind();
}
If I run this code on MacOS, it draws correctly as the screenshot below.
But If I run the same code on iOS, the bound texture is not drawing correctly.
When I print the texCoords of the plane mesh, it is correctly set. so I don’t think it is ofMesh’s problem but I think it is ofFbo’s texture’s problem.
Could any one please give me an advice on fixing this issue?
Thanks in advance!