-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathRenderAPI_OpenGLWatermark.h
More file actions
49 lines (38 loc) · 1.02 KB
/
RenderAPI_OpenGLWatermark.h
File metadata and controls
49 lines (38 loc) · 1.02 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
#ifndef RENDERAPI_OPENGLWATERMARK_H
#define RENDERAPI_OPENGLWATERMARK_H
#if defined(UNITY_IPHONE)
# include <OpenGLES/ES2/gl.h>
#elif defined(UNITY_OSX)
# include <OpenGL/GL.h>
#elif defined(UNITY_ANDROID) || defined(UNITY_WEBGL)
# include <GLES2/gl2.h>
#elif defined(UNITY_LINUX)
# define GL_GLEXT_PROTOTYPES
# include <GL/gl.h>
# include <GL/glext.h>
#elif defined(UNITY_WIN)
# define GL_GLEXT_PROTOTYPES
# include "GLEW/glew.h"
#else
# error "OpenGL not implemented"
#endif
class OpenGLWatermark
{
public:
bool setup();
void cleanup();
void draw(GLuint framebuffer, unsigned width, unsigned height);
void randomizePosition();
private:
void updateVertexBuffer();
GLuint program = 0;
GLuint vbo = 0;
GLuint tex = 0;
GLuint posAttrib = 0;
GLuint uvAttrib = 0;
float xOffset = -1.f;
float yOffset = 1.f;
uint32_t frameCounter = 0;
static const uint32_t REPOSITION_INTERVAL = 150; // Move watermark every ~2.5 seconds at 60fps
};
#endif /* RENDERAPI_OPENGLWATERMARK_H */