The `NVGLUframebuffer` structure contains a `ctx` member but was actually never used. This commit takes advantage of the `ctx` property so there is no need to keep the reference of the context elsewhere after calling `nvgluCreateFramebuffer()`, or it would add difficulty for maintenance. As a result, the `nvgluDeleteFramebuffer()` function only needs to take one `NVGLUframebuffer` instance as the parameter.
The framebuffer and renderbuffer did restore in `nvgluCreateFramebuffer()` on succeed. However, they are not restored if error occurs. This commit fixes it.
To support FBO for iOS, the current framebuffer and renderbuffer must be restored after calling nvgluCreateFramebuffer(). The framebuffer should also be restored when calling nvgluBindFramebuffer(NULL) as well.
- API changed!
- moved image repeat from nvgImagePattern() into image creation
nvgCreateImage*()
- made flip-y and premultiplied common image flags (not just GL)
- removed nvglImageFlags(), flags passed in via
nvglCreateImageFromHandle() flags
- nvgluCreateFramebuffer takes image flags as param
- all colors in the shader is handled as premultiplied
- removed alphaBlend param from nvgBeginFrame(), it became obsolete
- added NVGL_TEXTURE_PREMULTIPLIED flag
- separated FBO example
- FBOs are treated as premultipied for correct alpha
- changed FBO storage from depth/stencil 24/8 to stencil 8
- moved discard to end of shader which restores the render speed again
- fixed flags setup in nvglCreateImageFromHandle
- changed frame buffer to only compile on GL3
- changed nvgluCreateFramebuffer() to return FBO struct instead of
filling existing one (for consistency)