OPENGL: Add a Context class used to describe the active OpenGL context

This commit is contained in:
Bastien Bouclet 2016-01-09 08:22:26 +01:00
parent 482255032e
commit ed38c20cce
17 changed files with 276 additions and 140 deletions

View file

@ -33,6 +33,7 @@
#if defined(USE_OPENGL) && !defined(USE_GLES2)
#include "graphics/colormasks.h"
#include "graphics/opengl/context.h"
#include "graphics/pixelbuffer.h"
#include "graphics/surface.h"
@ -47,15 +48,14 @@ Renderer *CreateGfxOpenGL(OSystem *system) {
}
OpenGLRenderer::OpenGLRenderer(OSystem *system) :
BaseRenderer(system),
_nonPowerOfTwoTexSupport(false) {
BaseRenderer(system) {
}
OpenGLRenderer::~OpenGLRenderer() {
}
Texture *OpenGLRenderer::createTexture(const Graphics::Surface *surface) {
return new OpenGLTexture(surface, _nonPowerOfTwoTexSupport);
return new OpenGLTexture(surface);
}
void OpenGLRenderer::freeTexture(Texture *texture) {
@ -71,11 +71,9 @@ void OpenGLRenderer::init() {
computeScreenViewport();
// Check the available OpenGL extensions
const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
if (strstr(extensions, "GL_ARB_texture_non_power_of_two"))
_nonPowerOfTwoTexSupport = true;
else
if (!OpenGLContext.NPOTSupported) {
warning("GL_ARB_texture_non_power_of_two is not available.");
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();