From 2bbc6e371fee2d2f467b647aeb6796eb568a3871 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 16 Feb 2017 16:59:37 -0800 Subject: [PATCH] GL: Support larger dimension buffers --- src/platform/opengl/gl.c | 18 ++++++++++-------- src/platform/opengl/gl.h | 1 + src/platform/qt/DisplayGL.cpp | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/platform/opengl/gl.c b/src/platform/opengl/gl.c index 31bb101aa..46d468d1b 100644 --- a/src/platform/opengl/gl.c +++ b/src/platform/opengl/gl.c @@ -7,13 +7,6 @@ #include -static const GLint _glVertices[] = { - 0, 0, - 256, 0, - 256, 256, - 0, 256 -}; - static const GLint _glTexCoords[] = { 0, 0, 1, 0, @@ -48,6 +41,15 @@ static void mGLContextSetDimensions(struct VideoBackend* v, unsigned width, unsi #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 @@ void mGLContextDrawFrame(struct VideoBackend* 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(); diff --git a/src/platform/opengl/gl.h b/src/platform/opengl/gl.h index a6412e919..dca6d5a2f 100644 --- a/src/platform/opengl/gl.h +++ b/src/platform/opengl/gl.h @@ -27,6 +27,7 @@ struct mGLContext { struct VideoBackend d; GLuint tex; + GLint vertices[8]; }; void mGLContextCreate(struct mGLContext*); diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index da5781a3c..5b50ea6fd 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -229,7 +229,7 @@ PainterGL::PainterGL(int majorVersion, QGLWidget* parent) 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]); } }