OpenGL: Fix GLES2 backend
Jeffrey Pfau jeffrey@endrift.com
Wed, 28 Oct 2015 23:21:43 -0700
2 files changed,
15 insertions(+),
0 deletions(-)
M
src/platform/opengl/gles2.c
→
src/platform/opengl/gles2.c
@@ -53,6 +53,10 @@ #else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); #endif + context->program = glCreateProgram(); + context->fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); + context->vertexShader = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(context->fragmentShader, 1, (const GLchar**) &_fragmentShader, 0); glShaderSource(context->vertexShader, 1, (const GLchar**) &_vertexShader, 0); glAttachShader(context->program, context->vertexShader);@@ -73,6 +77,9 @@
static void GBAGLES2ContextDeinit(struct VideoBackend* v) { struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; glDeleteTextures(1, &context->tex); + glDeleteShader(context->fragmentShader); + glDeleteShader(context->vertexShader); + glDeleteProgram(context->program); } static void GBAGLES2ContextResized(struct VideoBackend* v, int w, int h) {
M
src/platform/opengl/gles2.h
→
src/platform/opengl/gles2.h
@@ -6,7 +6,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GLES2_H #define GLES2_H +#ifdef BUILD_GL +#ifdef __APPLE__ +#include <OpenGL/gl.h> +#else +#include <GL/gl.h> +#endif +#else #include <GLES2/gl2.h> +#endif #include "platform/video-backend.h"