-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderer.h
More file actions
74 lines (60 loc) · 1.69 KB
/
Copy pathRenderer.h
File metadata and controls
74 lines (60 loc) · 1.69 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef ANDROIDGLINVESTIGATIONS_RENDERER_H
#define ANDROIDGLINVESTIGATIONS_RENDERER_H
#include <EGL/egl.h>
#include <memory>
#include "Model.h"
#include "Shader.h"
struct android_app;
class Renderer {
public:
/*!
* @param pApp the android_app this Renderer belongs to, needed to configure GL
*/
inline Renderer(android_app *pApp) :
app_(pApp),
display_(EGL_NO_DISPLAY),
surface_(EGL_NO_SURFACE),
context_(EGL_NO_CONTEXT),
width_(0),
height_(0),
shaderNeedsNewProjectionMatrix_(true) {
initRenderer();
}
virtual ~Renderer();
/*!
* Handles input from the android_app.
*
* Note: this will clear the input queue
*/
void handleInput();
/*!
* Renders all the models in the renderer
*/
void render();
private:
/*!
* Performs necessary OpenGL initialization. Customize this if you want to change your EGL
* context or application-wide settings.
*/
void initRenderer();
/*!
* @brief we have to check every frame to see if the framebuffer has changed in size. If it has,
* update the viewport accordingly
*/
void updateRenderArea();
/*!
* Creates the models for this sample. You'd likely load a scene configuration from a file or
* use some other setup logic in your full game.
*/
void createModels();
android_app *app_;
EGLDisplay display_;
EGLSurface surface_;
EGLContext context_;
EGLint width_;
EGLint height_;
bool shaderNeedsNewProjectionMatrix_;
std::unique_ptr<Shader> shader_;
std::vector<Model> models_;
};
#endif //ANDROIDGLINVESTIGATIONS_RENDERER_H