GL: Support larger dimension buffers
Vicki Pfau vi@endrift.com
Thu, 16 Feb 2017 16:59:37 -0800
3 files changed,
12 insertions(+),
9 deletions(-)
M
src/platform/opengl/gl.c
→
src/platform/opengl/gl.c
@@ -7,13 +7,6 @@ #include "gl.h"
#include <mgba-util/math.h> -static const GLint _glVertices[] = { - 0, 0, - 256, 0, - 256, 256, - 0, 256 -}; - static const GLint _glTexCoords[] = { 0, 0, 1, 0,@@ -48,6 +41,15 @@ #endif
#else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, toPow2(width), toPow2(height), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); #endif + + context->vertices[0] = 0; + context->vertices[1] = 0; + context->vertices[2] = toPow2(width); + context->vertices[3] = 0; + context->vertices[4] = toPow2(width); + context->vertices[5] = toPow2(height); + context->vertices[6] = 0; + context->vertices[7] = toPow2(height); } static void mGLContextDeinit(struct VideoBackend* v) {@@ -83,7 +85,7 @@ struct mGLContext* context = (struct mGLContext*) v;
glEnable(GL_TEXTURE_2D); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_INT, 0, _glVertices); + glVertexPointer(2, GL_INT, 0, context->vertices); glTexCoordPointer(2, GL_INT, 0, _glTexCoords); glMatrixMode(GL_PROJECTION); glLoadIdentity();
M
src/platform/opengl/gl.h
→
src/platform/opengl/gl.h
@@ -27,6 +27,7 @@ struct mGLContext {
struct VideoBackend d; GLuint tex; + GLint vertices[8]; }; void mGLContextCreate(struct mGLContext*);
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -229,7 +229,7 @@ m_backend->filter = false;
m_backend->lockAspectRatio = false; for (int i = 0; i < 2; ++i) { - m_free.append(new uint32_t[256 * 256]); + m_free.append(new uint32_t[256 * 384]); } }