has anyone got mip mapping working in ofFbo?
i had a quick look but couldn’t see any obvious way of doing it…
L.
has anyone got mip mapping working in ofFbo?
i had a quick look but couldn’t see any obvious way of doing it…
L.
I don’t think it’s super easy without a little hacking, afaik you have to create it in the color buffer textures when those are allocated, and you can then you can use glGenerateMipmapEXT() when you actually draw the texture like:
glBindTexture(GL_TEXTURE_2D, textureId);
glGenerateMipmapEXT(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
I guess that would have to go in ofTexture, though. There’s more info on that here:
http://www.songho.ca/opengl/gl-fbo.html
As a thought, it might be nice to allow for either glGenerateMipmap() or a flag in ofTexture::allocate so that people can call glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
Looks like glGenerateMipmapEXT() is more recent/preferable but I don’t know how that would work on mobile platforms…
thx Joshua,
i remember modifying ofTexture on a iOS project using OF 0062 and the below approach worked,
its a copy and paste from github so the (-) represents the code thats been removed and (+) the code added.
-void ofTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBExtention)
+void ofTexture::allocate(int w, int h, int internalGlDataType, bool bUseARBExtention, bool bGenerateMipmaps)
i really don’t want to start hacking at OF 007 so was hoping to find some work around.
but ofFbo takes care of the ofTexture creation so its probably unlikely…
be nice to pass in something like bMakeMipMap into ofSettings and have ofFbo handle the rest.
L.
post it as an issue (feature request) on github! i think ofFbo is pretty full featured, and it wouldn’t be a bad idea to add something like this to it.
Done: https://github.com/openframeworks/openFrameworks/issues/810
@julapy thanks for bringing this up, I think it’ll be a good thing to have included.