Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
172 lines (145 loc) · 7.03 KB

File metadata and controls

172 lines (145 loc) · 7.03 KB
 
Jun 17, 2010
Jun 17, 2010
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/* San Angeles Observation OpenGL ES version example
* Copyright 2004-2005 Jetro Lauha
* All rights reserved.
* Web: http://iki.fi/jetro/
*
* This source is free software; you can redistribute it and/or
* modify it under the terms of EITHER:
* (1) The GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at
* your option) any later version. The text of the GNU Lesser
* General Public License is included with this source in the
* file LICENSE-LGPL.txt.
* (2) The BSD-style license that is included with this source in
* the file LICENSE-BSD.txt.
*
* This source is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
* LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
*
* $Id: importgl.h,v 1.4 2005/02/24 20:29:33 tonic Exp $
* $Revision: 1.4 $
*/
#ifndef IMPORTGL_H_INCLUDED
#define IMPORTGL_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <GLES/gl.h>
#ifndef ANDROID_NDK
#include <GLES/egl.h>
#endif /* !ANDROID_NDK */
/* Use DISABLE_IMPORTGL if you want to link the OpenGL ES at
* compile/link time and not import it dynamically runtime.
*/
#ifndef DISABLE_IMPORTGL
/* Dynamically fetches pointers to the egl & gl functions.
* Should be called once on application initialization.
* Returns non-zero on success and 0 on failure.
*/
extern int importGLInit();
/* Frees the handle to egl & gl functions library.
*/
extern void importGLDeinit();
#ifndef IMPORTGL_API
#define IMPORTGL_API extern
#endif
#ifndef IMPORTGL_FNPTRINIT
#define IMPORTGL_FNPTRINIT
#endif
#define FNDEF(retType, funcName, args) IMPORTGL_API retType (*funcPtr_##funcName) args IMPORTGL_FNPTRINIT
#ifndef ANDROID_NDK
FNDEF(EGLBoolean, eglChooseConfig, (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config));
FNDEF(EGLContext, eglCreateContext, (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list));
FNDEF(EGLSurface, eglCreateWindowSurface, (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list));
FNDEF(EGLBoolean, eglDestroyContext, (EGLDisplay dpy, EGLContext ctx));
FNDEF(EGLBoolean, eglDestroySurface, (EGLDisplay dpy, EGLSurface surface));
FNDEF(EGLBoolean, eglGetConfigAttrib, (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value));
FNDEF(EGLBoolean, eglGetConfigs, (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config));
FNDEF(EGLDisplay, eglGetDisplay, (NativeDisplayType display));
FNDEF(EGLint, eglGetError, (void));
FNDEF(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint *major, EGLint *minor));
FNDEF(EGLBoolean, eglMakeCurrent, (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx));
FNDEF(EGLBoolean, eglSwapBuffers, (EGLDisplay dpy, EGLSurface draw));
FNDEF(EGLBoolean, eglTerminate, (EGLDisplay dpy));
#endif /* !ANDROID_NDK */
FNDEF(void, glBlendFunc, (GLenum sfactor, GLenum dfactor));
FNDEF(void, glClear, (GLbitfield mask));
FNDEF(void, glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha));
FNDEF(void, glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha));
FNDEF(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
FNDEF(void, glDisable, (GLenum cap));
FNDEF(void, glDisableClientState, (GLenum array));
FNDEF(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count));
FNDEF(void, glEnable, (GLenum cap));
FNDEF(void, glEnableClientState, (GLenum array));
FNDEF(void, glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar));
FNDEF(GLenum, glGetError, (void));
FNDEF(void, glLightxv, (GLenum light, GLenum pname, const GLfixed *params));
FNDEF(void, glLoadIdentity, (void));
FNDEF(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param));
FNDEF(void, glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params));
FNDEF(void, glMatrixMode, (GLenum mode));
FNDEF(void, glMultMatrixx, (const GLfixed *m));
FNDEF(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer));
FNDEF(void, glPopMatrix, (void));
FNDEF(void, glPushMatrix, (void));
FNDEF(void, glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z));
FNDEF(void, glScalex, (GLfixed x, GLfixed y, GLfixed z));
FNDEF(void, glShadeModel, (GLenum mode));
FNDEF(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z));
FNDEF(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
FNDEF(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
#undef FN
#define FNPTR(name) funcPtr_##name
#ifndef IMPORTGL_NO_FNPTR_DEFS
// Redirect egl* and gl* function calls to funcPtr_egl* and funcPtr_gl*.
#ifndef ANDROID_NDK
#define eglChooseConfig FNPTR(eglChooseConfig)
#define eglCreateContext FNPTR(eglCreateContext)
#define eglCreateWindowSurface FNPTR(eglCreateWindowSurface)
#define eglDestroyContext FNPTR(eglDestroyContext)
#define eglDestroySurface FNPTR(eglDestroySurface)
#define eglGetConfigAttrib FNPTR(eglGetConfigAttrib)
#define eglGetConfigs FNPTR(eglGetConfigs)
#define eglGetDisplay FNPTR(eglGetDisplay)
#define eglGetError FNPTR(eglGetError)
#define eglInitialize FNPTR(eglInitialize)
#define eglMakeCurrent FNPTR(eglMakeCurrent)
#define eglSwapBuffers FNPTR(eglSwapBuffers)
#define eglTerminate FNPTR(eglTerminate)
#endif /* !ANDROID_NDK */
#define glBlendFunc FNPTR(glBlendFunc)
#define glClear FNPTR(glClear)
#define glClearColorx FNPTR(glClearColorx)
#define glColor4x FNPTR(glColor4x)
#define glColorPointer FNPTR(glColorPointer)
#define glDisable FNPTR(glDisable)
#define glDisableClientState FNPTR(glDisableClientState)
#define glDrawArrays FNPTR(glDrawArrays)
#define glEnable FNPTR(glEnable)
#define glEnableClientState FNPTR(glEnableClientState)
#define glFrustumx FNPTR(glFrustumx)
#define glGetError FNPTR(glGetError)
#define glLightxv FNPTR(glLightxv)
#define glLoadIdentity FNPTR(glLoadIdentity)
#define glMaterialx FNPTR(glMaterialx)
#define glMaterialxv FNPTR(glMaterialxv)
#define glMatrixMode FNPTR(glMatrixMode)
#define glMultMatrixx FNPTR(glMultMatrixx)
#define glNormalPointer FNPTR(glNormalPointer)
#define glPopMatrix FNPTR(glPopMatrix)
#define glPushMatrix FNPTR(glPushMatrix)
#define glRotatex FNPTR(glRotatex)
#define glScalex FNPTR(glScalex)
#define glShadeModel FNPTR(glShadeModel)
#define glTranslatex FNPTR(glTranslatex)
#define glVertexPointer FNPTR(glVertexPointer)
#define glViewport FNPTR(glViewport)
#endif // !IMPORTGL_NO_FNPTR_DEFS
#endif // !DISABLE_IMPORTGL
#ifdef __cplusplus
}
#endif
#endif // !IMPORTGL_H_INCLUDED