openframeworks/openFrameworks — pull request #2191 by tgfrerer (2013-07-08 16:08:32+00:00)
Title: Feature programmable GL texture mipmaps

This adds a method to generate MipMaps for ofTextures using the new (OpenGL 3.2+) core API methods:

ofTexture::generateMipmaps(GLint minFilter = GL_LINEAR_MIPMAP_LINEAR, GLint magFilter = GL_LINEAR)

* This method would only affect the programmableGL renderer.
* i'm not using gluBuild2dMipmaps, but the new openGL core API for mipmaps, since gluBuild2DMipmaps is deprecated (and will, for example, disappear from the OS X 10.9 SDK)
* see: https://www.opengl.org/wiki/Common_Mistakes#gluBuild2DMipmaps

Since ofTexture mipmaps would also affect ofFbo if mipmaps were switched on my default i thought it sensible to let the user decide when to create mipmaps (and when to update their mipmaps), so mipmaps are not generated by default.

Since this adds a new method to the API i'd be curious to hear everyone's opinion on how best to include mipmapping (and how much of the internals to expose).

By default, this sets the min/mag filters for the texture it affects to:

GL_TEXTURE_MIN_FILTER --> GL_LINEAR_MIPMAP_LINEAR
GL_TEXTURE_MAG_FILTER --> GL_LINEAR

Also,

ofSetMinMagFilters()

and

ofSetTextureWrap()

are global functions, assuming a current texture target to be bound. That is most likely going to lead to lead to problems with the programmable GL renderer, and should be deprecated, IMHO.