OpenGL: Fix GLES2 backend

This commit is contained in:
Jeffrey Pfau 2015-10-28 23:21:43 -07:00
parent a3803a853c
commit 6cdfb3ae9a
2 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,10 @@ static void GBAGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
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 GBAGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
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) {

View File

@ -6,7 +6,15 @@
#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"