Fixed Canvases on iOS, added support for Canvas MSAA on OpenGL ES 3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-24 02:36:32 -04:00
parent 52c4f2c119
commit 517ee44e84
4 changed files with 46 additions and 28 deletions
+21 -3
View File
@@ -36,6 +36,10 @@
// For SDL_GL_GetProcAddress.
#include <SDL_video.h>
#ifdef LOVE_IOS
#include <SDL_system.h>
#endif
namespace love
{
namespace graphics
@@ -49,6 +53,7 @@ OpenGL::OpenGL()
, maxAnisotropy(1.0f)
, maxTextureSize(0)
, maxRenderTargets(0)
, maxRenderbufferSamples(0)
, vendor(VENDOR_UNKNOWN)
, state()
{
@@ -124,8 +129,6 @@ void OpenGL::setupContext()
glActiveTexture(curgltextureunit);
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint *) &state.defaultFBO);
BlendState blend = {GL_ONE, GL_ONE, GL_ZERO, GL_ZERO, GL_FUNC_ADD};
setBlendState(blend);
@@ -215,6 +218,11 @@ void OpenGL::initMaxValues()
}
maxRenderTargets = std::min(maxattachments, maxdrawbuffers);
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object || GLAD_EXT_framebuffer_multisample)
glGetIntegerv(GL_MAX_SAMPLES, &maxRenderbufferSamples);
else
maxRenderbufferSamples = 0;
}
void OpenGL::initMatrices()
@@ -423,7 +431,12 @@ float OpenGL::getPointSize() const
GLuint OpenGL::getDefaultFBO() const
{
return state.defaultFBO;
#ifdef LOVE_IOS
// Hack: iOS uses a custom FBO.
return SDL_iPhoneGetViewFramebuffer(SDL_GL_GetCurrentWindow());
#else
return 0;
#endif
}
GLuint OpenGL::getDefaultTexture() const
@@ -560,6 +573,11 @@ int OpenGL::getMaxRenderTargets() const
return maxRenderTargets;
}
int OpenGL::getMaxRenderbufferSamples() const
{
return maxRenderbufferSamples;
}
void OpenGL::updateTextureMemorySize(size_t oldsize, size_t newsize)
{
int64 memsize = (int64) stats.textureMemory + ((int64 )newsize - (int64) oldsize);