src/platform/opengl/gles2.h (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef GLES2_H
7#define GLES2_H
8
9#ifdef BUILD_GL
10#ifdef __APPLE__
11#include <OpenGL/gl.h>
12#else
13#include <GL/gl.h>
14#endif
15#else
16#include <GLES2/gl2.h>
17#endif
18
19#include "platform/video-backend.h"
20
21struct GBAGLES2Shader {
22 unsigned width;
23 unsigned height;
24 bool filter;
25 bool blend;
26 GLuint tex;
27 GLuint fbo;
28 GLuint fragmentShader;
29 GLuint program;
30 GLuint texLocation;
31 GLuint positionLocation;
32};
33
34struct GBAGLES2Context {
35 struct VideoBackend d;
36
37 GLuint tex;
38 GLuint fragmentShader;
39 GLuint vertexShader;
40 GLuint nullVertexShader;
41 GLuint program;
42 GLuint bufferObject;
43 GLuint texLocation;
44 GLuint positionLocation;
45 GLuint gammaLocation;
46 GLuint biasLocation;
47 GLuint scaleLocation;
48
49 GLfloat gamma;
50 GLfloat bias[3];
51 GLfloat scale[3];
52
53 struct GBAGLES2Shader* shader;
54};
55
56void GBAGLES2ContextCreate(struct GBAGLES2Context*);
57
58void GBAGLES2ShaderInit(struct GBAGLES2Shader*, const char*, int width, int height);
59void GBAGLES2ShaderDeinit(struct GBAGLES2Shader*);
60void GBAGLES2ShaderAttach(struct GBAGLES2Context*, struct GBAGLES2Shader*);
61void GBAGLES2ShaderDetach(struct GBAGLES2Context*);
62
63#endif