mirror of https://github.com/mgba-emu/mgba.git
OpenGL: Fix GLES2 backend
This commit is contained in:
parent
a3803a853c
commit
6cdfb3ae9a
|
@ -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);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
#endif
|
#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->fragmentShader, 1, (const GLchar**) &_fragmentShader, 0);
|
||||||
glShaderSource(context->vertexShader, 1, (const GLchar**) &_vertexShader, 0);
|
glShaderSource(context->vertexShader, 1, (const GLchar**) &_vertexShader, 0);
|
||||||
glAttachShader(context->program, context->vertexShader);
|
glAttachShader(context->program, context->vertexShader);
|
||||||
|
@ -73,6 +77,9 @@ static void GBAGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
|
||||||
static void GBAGLES2ContextDeinit(struct VideoBackend* v) {
|
static void GBAGLES2ContextDeinit(struct VideoBackend* v) {
|
||||||
struct GBAGLES2Context* context = (struct GBAGLES2Context*) v;
|
struct GBAGLES2Context* context = (struct GBAGLES2Context*) v;
|
||||||
glDeleteTextures(1, &context->tex);
|
glDeleteTextures(1, &context->tex);
|
||||||
|
glDeleteShader(context->fragmentShader);
|
||||||
|
glDeleteShader(context->vertexShader);
|
||||||
|
glDeleteProgram(context->program);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GBAGLES2ContextResized(struct VideoBackend* v, int w, int h) {
|
static void GBAGLES2ContextResized(struct VideoBackend* v, int w, int h) {
|
||||||
|
|
|
@ -6,7 +6,15 @@
|
||||||
#ifndef GLES2_H
|
#ifndef GLES2_H
|
||||||
#define 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>
|
#include <GLES2/gl2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "platform/video-backend.h"
|
#include "platform/video-backend.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue