/
opengl.hpp
53 lines (44 loc) · 1.23 KB
/
opengl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2009-2023 Jan Niklas Hasse <jhasse@bixense.com>
// For conditions of distribution and use, see copyright notice in LICENSE.txt
#pragma once
#include "jngl/Mat3.hpp"
#include "jngl/Mat4.hpp"
#ifdef IOS
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#else
#ifdef ANDROID
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
#else
#if defined (JNGL_UWP) || defined (__EMSCRIPTEN__)
#define GL_GLEXT_PROTOTYPES 1
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define glGenVertexArrays glGenVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glDeleteVertexArrays glDeleteVertexArraysOES
#if defined(__EMSCRIPTEN__)
#define GL_RGBA8 GL_RGBA8_OES
#endif
#else
#include <glad/gl.h>
#endif
#endif
#endif
#ifndef GL_BGR
#define GL_BGR 0x80e0
#endif
namespace opengl
{
extern jngl::Mat3 modelview;
extern jngl::Mat4 projection;
/// A global VAO and VBO which are used with GL_STREAM_DRAW
extern GLuint vaoStream;
extern GLuint vboStream;
void translate(float x, float y);
void scale(float x, float y);
/// Generates a textures, binds it to GL_TEXTURE_2D and sets some common parameters
GLuint genAndBindTexture();
} // namespace opengl