GL 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSG_OPENGL
  14. #define OSG_OPENGL 1
  15. #include <osg/Config>
  16. #include <osg/Export>
  17. #include <osg/Types>
  18. #define OSG_GL1_AVAILABLE
  19. #define OSG_GL2_AVAILABLE
  20. /* #undef OSG_GL3_AVAILABLE */
  21. /* #undef OSG_GLES1_AVAILABLE */
  22. /* #undef OSG_GLES2_AVAILABLE */
  23. /* #undef OSG_GLES3_AVAILABLE */
  24. /* #undef OSG_GL_LIBRARY_STATIC */
  25. #define OSG_GL_DISPLAYLISTS_AVAILABLE
  26. #define OSG_GL_MATRICES_AVAILABLE
  27. #define OSG_GL_VERTEX_FUNCS_AVAILABLE
  28. #define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
  29. #define OSG_GL_FIXED_FUNCTION_AVAILABLE
  30. /* #undef GL_HEADER_HAS_GLINT64 */
  31. /* #undef GL_HEADER_HAS_GLUINT64 */
  32. #define OSG_GL1_FEATURES 1
  33. #define OSG_GL2_FEATURES 1
  34. #define OSG_GL3_FEATURES 0
  35. #define OSG_GLES1_FEATURES 0
  36. #define OSG_GLES2_FEATURES 0
  37. #define OSG_GLES3_FEATURES 0
  38. #define OSG_GL_CONTEXT_VERSION "1.0"
  39. #ifndef WIN32
  40. // Required for compatibility with glext.h style function definitions of
  41. // OpenGL extensions, such as in src/osg/Point.cpp.
  42. #ifndef APIENTRY
  43. #define APIENTRY
  44. #endif
  45. #else // WIN32
  46. #if defined(__CYGWIN__) || defined(__MINGW32__)
  47. #ifndef APIENTRY
  48. #define GLUT_APIENTRY_DEFINED
  49. #define APIENTRY __stdcall
  50. #endif
  51. // XXX This is from Win32's <windef.h>
  52. #ifndef CALLBACK
  53. #define CALLBACK __stdcall
  54. #endif
  55. #else // ! __CYGWIN__
  56. // Under Windows avoid including <windows.h>
  57. // to avoid name space pollution, but Win32's <GL/gl.h>
  58. // needs APIENTRY and WINGDIAPI defined properly.
  59. // XXX This is from Win32's <windef.h>
  60. #ifndef APIENTRY
  61. #define GLUT_APIENTRY_DEFINED
  62. #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
  63. #define WINAPI __stdcall
  64. #define APIENTRY WINAPI
  65. #else
  66. #define APIENTRY
  67. #endif
  68. #endif
  69. // XXX This is from Win32's <windef.h>
  70. #ifndef CALLBACK
  71. #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
  72. #define CALLBACK __stdcall
  73. #else
  74. #define CALLBACK
  75. #endif
  76. #endif
  77. #endif // __CYGWIN__
  78. // XXX This is from Win32's <wingdi.h> and <winnt.h>
  79. #ifndef WINGDIAPI
  80. #define GLUT_WINGDIAPI_DEFINED
  81. #define DECLSPEC_IMPORT __declspec(dllimport)
  82. #define WINGDIAPI DECLSPEC_IMPORT
  83. #endif
  84. // XXX This is from Win32's <ctype.h>
  85. #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ > 2))
  86. typedef unsigned short wchar_t;
  87. #define _WCHAR_T_DEFINED
  88. #endif
  89. #endif // WIN32
  90. #if defined(OSG_GL3_AVAILABLE)
  91. #define GL3_PROTOTYPES 1
  92. #define GL_GLEXT_PROTOTYPES 1
  93. #endif
  94. #include <GL/gl.h>
  95. #ifndef GL_APIENTRY
  96. #define GL_APIENTRY APIENTRY
  97. #endif // GL_APIENTRY
  98. #ifndef GL_HEADER_HAS_GLINT64
  99. typedef int64_t GLint64;
  100. #endif
  101. #ifndef GL_HEADER_HAS_GLUINT64
  102. typedef uint64_t GLuint64;
  103. #endif
  104. #ifdef OSG_GL_MATRICES_AVAILABLE
  105. inline void glLoadMatrix(const float* mat) { glLoadMatrixf(static_cast<const GLfloat*>(mat)); }
  106. inline void glMultMatrix(const float* mat) { glMultMatrixf(static_cast<const GLfloat*>(mat)); }
  107. #ifdef OSG_GLES1_AVAILABLE
  108. inline void glLoadMatrix(const double* mat)
  109. {
  110. GLfloat flt_mat[16];
  111. for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
  112. glLoadMatrixf(flt_mat);
  113. }
  114. inline void glMultMatrix(const double* mat)
  115. {
  116. GLfloat flt_mat[16];
  117. for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
  118. glMultMatrixf(flt_mat);
  119. }
  120. #else
  121. inline void glLoadMatrix(const double* mat) { glLoadMatrixd(static_cast<const GLdouble*>(mat)); }
  122. inline void glMultMatrix(const double* mat) { glMultMatrixd(static_cast<const GLdouble*>(mat)); }
  123. #endif
  124. #endif
  125. // add defines for OpenGL targets that don't define them, just to ease compatibility across targets
  126. #ifndef GL_DOUBLE
  127. #define GL_DOUBLE 0x140A
  128. typedef double GLdouble;
  129. #endif
  130. #ifndef GL_INT
  131. #define GL_INT 0x1404
  132. #endif
  133. #ifndef GL_UNSIGNED_INT
  134. #define GL_UNSIGNED_INT 0x1405
  135. #endif
  136. #ifndef GL_NONE
  137. // OpenGL ES1 doesn't provide GL_NONE
  138. #define GL_NONE 0x0
  139. #endif
  140. #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
  141. //GLES defines (OES)
  142. #define GL_RGB8_OES 0x8051
  143. #define GL_RGBA8_OES 0x8058
  144. #endif
  145. #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
  146. #define GL_POLYGON 0x0009
  147. #define GL_QUADS 0x0007
  148. #define GL_QUAD_STRIP 0x0008
  149. #endif
  150. #if defined(OSG_GL3_AVAILABLE)
  151. #define GL_LUMINANCE 0x1909
  152. #define GL_LUMINANCE_ALPHA 0x190A
  153. #endif
  154. #endif