ofFbo enable mipmap

@tgfrerer has done an awesome job getting mipmaps to work with ofTexture.

just wanted to open up a discussion on how mipmapping can work with ofFbo.

this issue first came up on the OF github,

1 Like

ive tried a few different things to get mip mapping working with ofFbo but with no result. the below code was my best hope, to create a ofTexture outside the ofFbo with mip mapping enabled, and then attach the ofTexture to the ofFbo. unfortunately i currently don’t have too much time to dig into the ofFbo internals, so just stabbing in the dark for the moment.

@tgfrerer atm im working on a project where i need to create a bunch of floating images (ofFbo’s) which shrink into the distance… without mip mapping this looks horrible. can you recommend a method for adding a mip mapped enabled ofTexture as a backing texture to a ofFbo?

ofFbo * fbo = new ofFbo();
fbo->allocate(w, h, GL_RGBA);

ofTexture fboTexture;
fboTexture.allocate(w, h, GL_RGBA);

fbo->attachTexture(fboTexture, fboTexture.getTextureData().glTypeInternal, 0);

Hey mate,

It should work for fbo’s the same as a normal texture, except you have to enable midmaps after every begin/draw/end for fbo. I’m not familiar with the new enableMipmap() methods that were added, but the raw gl calls work. Here’s a sample…

hey @trentbrooks, thanks for the pointers.
ive played around with it some more today and got it working.
here is how you can do it just with the OF api

fbo.allocate(w, h, GL_RGBA);


ofClear(255, 255);
// draw something.


ofTexture & fboTexture = fbo.getTextureReference();
fboTexture.setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);