-
Notifications
You must be signed in to change notification settings - Fork 8
/
egl_wrapper.h
72 lines (58 loc) · 2.36 KB
/
egl_wrapper.h
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
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_EGL_WRAPPER_H_
#define UI_OZONE_EGL_WRAPPER_H_
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#define OZONE_EGL_SUCCESS 1
#define OZONE_EGL_FAILURE 0
#define GLCheckError() \
{ \
GLint err = glGetError(); \
if (err != GL_NO_ERROR) \
{ \
fprintf(stderr, "\nfunction: %s, line: %d, err: 0x%x\n", \
__FUNCTION__, __LINE__, err); \
return HI_FAILURE; \
} \
}
#define EGLCheckError() \
{ \
GLint err = eglGetError(); \
if (err != EGL_SUCCESS) \
{ \
fprintf(stderr, "\nfunction: %s, line: %d, err: 0x%x\n", \
__FUNCTION__, __LINE__, err); \
return HI_FAILURE; \
} \
}
typedef struct
{
// Handle to a program object
GLuint programObject;
// Attribute locations
GLint positionLoc;
GLint texCoordLoc;
// Sampler location
GLint samplerLoc;
// Texture handle
GLuint textureId;
GLint colorType;
GLint width;
GLint height;
char * data;
} ozone_egl_UserData;
EGLint ozone_egl_setup(EGLint x, EGLint y, EGLint width, EGLint height );
int ozone_egl_destroy();
int ozone_egl_swap();
NativeDisplayType ozone_egl_getNativedisp();
EGLint * ozone_egl_getConfigAttribs();
EGLDisplay ozone_egl_getdisp();
EGLSurface ozone_egl_getsurface();
void ozone_egl_makecurrent();
int ozone_egl_textureInit (ozone_egl_UserData * userData );
void ozone_egl_textureDraw ( ozone_egl_UserData *userData );
void ozone_egl_textureShutDown ( ozone_egl_UserData *userData );
#endif