/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. #ifndef IMPORTGL_H_INCLUDED
  25. #define IMPORTGL_H_INCLUDED
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #include <GLES/gl.h>
  30. #ifndef ANDROID_NDK
  31. #include <GLES/egl.h>
  32. #endif /* !ANDROID_NDK */
  33. /* Use DISABLE_IMPORTGL if you want to link the OpenGL ES at
  34. * compile/link time and not import it dynamically runtime.
  35. */
  36. #ifndef DISABLE_IMPORTGL
  37. /* Dynamically fetches pointers to the egl & gl functions.
  38. * Should be called once on application initialization.
  39. * Returns non-zero on success and 0 on failure.
  40. */
  41. extern int importGLInit();
  42. /* Frees the handle to egl & gl functions library.
  43. */
  44. extern void importGLDeinit();
  45. #ifndef IMPORTGL_API
  46. #define IMPORTGL_API extern
  47. #endif
  48. #ifndef IMPORTGL_FNPTRINIT
  49. #define IMPORTGL_FNPTRINIT
  50. #endif
  51. #define FNDEF(retType, funcName, args) IMPORTGL_API retType (*funcPtr_##funcName) args IMPORTGL_FNPTRINIT
  52. #ifndef ANDROID_NDK
  53. FNDEF(EGLBoolean, eglChooseConfig, (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config));
  54. FNDEF(EGLContext, eglCreateContext, (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list));
  55. FNDEF(EGLSurface, eglCreateWindowSurface, (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list));
  56. FNDEF(EGLBoolean, eglDestroyContext, (EGLDisplay dpy, EGLContext ctx));
  57. FNDEF(EGLBoolean, eglDestroySurface, (EGLDisplay dpy, EGLSurface surface));
  58. FNDEF(EGLBoolean, eglGetConfigAttrib, (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value));
  59. FNDEF(EGLBoolean, eglGetConfigs, (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config));
  60. FNDEF(EGLDisplay, eglGetDisplay, (NativeDisplayType display));
  61. FNDEF(EGLint, eglGetError, (void));
  62. FNDEF(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint *major, EGLint *minor));
  63. FNDEF(EGLBoolean, eglMakeCurrent, (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx));
  64. FNDEF(EGLBoolean, eglSwapBuffers, (EGLDisplay dpy, EGLSurface draw));
  65. FNDEF(EGLBoolean, eglTerminate, (EGLDisplay dpy));
  66. #endif /* !ANDROID_NDK */
  67. FNDEF(void, glBlendFunc, (GLenum sfactor, GLenum dfactor));
  68. FNDEF(void, glClear, (GLbitfield mask));
  69. FNDEF(void, glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha));
  70. FNDEF(void, glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha));
  71. FNDEF(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
  72. FNDEF(void, glDisable, (GLenum cap));
  73. FNDEF(void, glDisableClientState, (GLenum array));
  74. FNDEF(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count));
  75. FNDEF(void, glEnable, (GLenum cap));
  76. FNDEF(void, glEnableClientState, (GLenum array));
  77. FNDEF(void, glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar));
  78. FNDEF(GLenum, glGetError, (void));
  79. FNDEF(void, glLightxv, (GLenum light, GLenum pname, const GLfixed *params));
  80. FNDEF(void, glLoadIdentity, (void));
  81. FNDEF(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param));
  82. FNDEF(void, glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params));
  83. FNDEF(void, glMatrixMode, (GLenum mode));
  84. FNDEF(void, glMultMatrixx, (const GLfixed *m));
  85. FNDEF(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer));
  86. FNDEF(void, glPopMatrix, (void));
  87. FNDEF(void, glPushMatrix, (void));
  88. FNDEF(void, glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z));
  89. FNDEF(void, glScalex, (GLfixed x, GLfixed y, GLfixed z));
  90. FNDEF(void, glShadeModel, (GLenum mode));
  91. FNDEF(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z));
  92. FNDEF(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer));
  93. FNDEF(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height));
  94. #undef FN
  95. #define FNPTR(name) funcPtr_##name
  96. #ifndef IMPORTGL_NO_FNPTR_DEFS
  97. // Redirect egl* and gl* function calls to funcPtr_egl* and funcPtr_gl*.
  98. #ifndef ANDROID_NDK
  99. #define eglChooseConfig FNPTR(eglChooseConfig)
  100. #define eglCreateContext FNPTR(eglCreateContext)
  101. #define eglCreateWindowSurface FNPTR(eglCreateWindowSurface)
  102. #define eglDestroyContext FNPTR(eglDestroyContext)
  103. #define eglDestroySurface FNPTR(eglDestroySurface)
  104. #define eglGetConfigAttrib FNPTR(eglGetConfigAttrib)
  105. #define eglGetConfigs FNPTR(eglGetConfigs)
  106. #define eglGetDisplay FNPTR(eglGetDisplay)
  107. #define eglGetError FNPTR(eglGetError)
  108. #define eglInitialize FNPTR(eglInitialize)
  109. #define eglMakeCurrent FNPTR(eglMakeCurrent)
  110. #define eglSwapBuffers FNPTR(eglSwapBuffers)
  111. #define eglTerminate FNPTR(eglTerminate)
  112. #endif /* !ANDROID_NDK */
  113. #define glBlendFunc FNPTR(glBlendFunc)
  114. #define glClear FNPTR(glClear)
  115. #define glClearColorx FNPTR(glClearColorx)
  116. #define glColor4x FNPTR(glColor4x)
  117. #define glColorPointer FNPTR(glColorPointer)
  118. #define glDisable FNPTR(glDisable)
  119. #define glDisableClientState FNPTR(glDisableClientState)
  120. #define glDrawArrays FNPTR(glDrawArrays)
  121. #define glEnable FNPTR(glEnable)
  122. #define glEnableClientState FNPTR(glEnableClientState)
  123. #define glFrustumx FNPTR(glFrustumx)
  124. #define glGetError FNPTR(glGetError)
  125. #define glLightxv FNPTR(glLightxv)
  126. #define glLoadIdentity FNPTR(glLoadIdentity)
  127. #define glMaterialx FNPTR(glMaterialx)
  128. #define glMaterialxv FNPTR(glMaterialxv)
  129. #define glMatrixMode FNPTR(glMatrixMode)
  130. #define glMultMatrixx FNPTR(glMultMatrixx)
  131. #define glNormalPointer FNPTR(glNormalPointer)
  132. #define glPopMatrix FNPTR(glPopMatrix)
  133. #define glPushMatrix FNPTR(glPushMatrix)
  134. #define glRotatex FNPTR(glRotatex)
  135. #define glScalex FNPTR(glScalex)
  136. #define glShadeModel FNPTR(glShadeModel)
  137. #define glTranslatex FNPTR(glTranslatex)
  138. #define glVertexPointer FNPTR(glVertexPointer)
  139. #define glViewport FNPTR(glViewport)
  140. #endif // !IMPORTGL_NO_FNPTR_DEFS
  141. #endif // !DISABLE_IMPORTGL
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145. #endif // !IMPORTGL_H_INCLUDED