Applying shader to ofxAssimpModelLoader?

I’m trying to use a shader to colour a 3ds model loaded with ofxAssimpModelLoader.

The shader works fine when applied to something simple like an ofDrawRectangle, but when I try to draw the shader to a texture then bind the texture when drawing the model it just shows a single colour? It seems to be grabbing a single pixel from the texture?

you can see in the pic the shader fbo being drawn in the background correctly and then the model in the foreground which is not having the texture applied correctly?


void ofApp::init()
{
	shader.load(shaderPath);

	fbo.allocate(shaderWidth, shaderHeight);

	if (!frameModel.loadModel(framePath))
	{
		ofSystemAlertDialog("Cannot open 3d file");
	}
	ofDisableArbTex();
}

void ofApp::update()
{
	fbo.begin();
	ofClear(0);	
	shader.begin();	
	// Set shader uniforms
	shader.setUniform3f( "iResolution", shaderWidth, shaderHeight, 0.0 );	
	ofDrawRectangle( 0, 0, shaderWidth, shaderHeight );	
	shader.end();
	fbo.end();
}

void ofApp::draw()
{
	// works fine
	fbo.draw(0, 0); 

	// not working?
	cam.begin();		
	ofTexture t = fbo.getTextureReference();
	t.bind();
		frameModel.drawFaces();
	t.unbind();
	cam.end();
}

win 10, of11

Looks like the ofDisableArbTex() function is called after fbo.allocate(). Try moving ofDisableArbTex() to before fbo.allocate()

thank’s nick that worked