cedricpinson/osgjs — pull request #99 by Teybeo (2014-08-07 14:56:17+00:00)
Title: Bug/fix tonemapping example

Add a dirty flag to regenerate the mipmaps of a texture

In the example, when sceneTexture changed, we were calling dirty() on lumTexture, thinking it will cause the mipmap chain to be regenerated.
In fact, this caused the texture to take this path https://github.com/cedricpinson/osgjs/blob/develop/sources/osg/Texture.js#L357-L369.
There, the texture was reallocated and initialized to 0 (glTexImage2D(..., null)), so the following call to generateMipmap wasn't supposed to work (even if it did on several platforms ...).
This patch adds a check if we want to regenerate the mipmap chain in the "normal" path of Texture.apply ( = texture allocated and not dirty).
The mipmapDirty flag is intialized to false so this patch won't change anything for the existing code.