PageRenderTime 52ms CodeModel.GetById 20ms app.highlight 12ms RepoModel.GetById 18ms app.codeStats 0ms

/FallingSandpaper/jni/importgl.h

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