importgl.h 7.1 KB

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