123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library 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
- * OpenSceneGraph Public License for more details.
- */
- #ifndef OSG_OPENGL
- #define OSG_OPENGL 1
- #include <osg/Config>
- #include <osg/Export>
- #include <osg/Types>
-
- #define OSG_GL1_AVAILABLE
- #define OSG_GL2_AVAILABLE
- /* #undef OSG_GL3_AVAILABLE */
- /* #undef OSG_GLES1_AVAILABLE */
- /* #undef OSG_GLES2_AVAILABLE */
- /* #undef OSG_GLES3_AVAILABLE */
- /* #undef OSG_GL_LIBRARY_STATIC */
- #define OSG_GL_DISPLAYLISTS_AVAILABLE
- #define OSG_GL_MATRICES_AVAILABLE
- #define OSG_GL_VERTEX_FUNCS_AVAILABLE
- #define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
- #define OSG_GL_FIXED_FUNCTION_AVAILABLE
- /* #undef GL_HEADER_HAS_GLINT64 */
- /* #undef GL_HEADER_HAS_GLUINT64 */
- #define OSG_GL1_FEATURES 1
- #define OSG_GL2_FEATURES 1
- #define OSG_GL3_FEATURES 0
- #define OSG_GLES1_FEATURES 0
- #define OSG_GLES2_FEATURES 0
- #define OSG_GLES3_FEATURES 0
- #define OSG_GL_CONTEXT_VERSION "1.0"
- #ifndef WIN32
- // Required for compatibility with glext.h style function definitions of
- // OpenGL extensions, such as in src/osg/Point.cpp.
- #ifndef APIENTRY
- #define APIENTRY
- #endif
- #else // WIN32
- #if defined(__CYGWIN__) || defined(__MINGW32__)
- #ifndef APIENTRY
- #define GLUT_APIENTRY_DEFINED
- #define APIENTRY __stdcall
- #endif
- // XXX This is from Win32's <windef.h>
- #ifndef CALLBACK
- #define CALLBACK __stdcall
- #endif
- #else // ! __CYGWIN__
- // Under Windows avoid including <windows.h>
- // to avoid name space pollution, but Win32's <GL/gl.h>
- // needs APIENTRY and WINGDIAPI defined properly.
- // XXX This is from Win32's <windef.h>
- #ifndef APIENTRY
- #define GLUT_APIENTRY_DEFINED
- #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
- #define WINAPI __stdcall
- #define APIENTRY WINAPI
- #else
- #define APIENTRY
- #endif
- #endif
- // XXX This is from Win32's <windef.h>
- #ifndef CALLBACK
- #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
- #define CALLBACK __stdcall
- #else
- #define CALLBACK
- #endif
- #endif
- #endif // __CYGWIN__
- // XXX This is from Win32's <wingdi.h> and <winnt.h>
- #ifndef WINGDIAPI
- #define GLUT_WINGDIAPI_DEFINED
- #define DECLSPEC_IMPORT __declspec(dllimport)
- #define WINGDIAPI DECLSPEC_IMPORT
- #endif
- // XXX This is from Win32's <ctype.h>
- #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ > 2))
- typedef unsigned short wchar_t;
- #define _WCHAR_T_DEFINED
- #endif
- #endif // WIN32
- #if defined(OSG_GL3_AVAILABLE)
- #define GL3_PROTOTYPES 1
- #define GL_GLEXT_PROTOTYPES 1
- #endif
- #include <GL/gl.h>
- #ifndef GL_APIENTRY
- #define GL_APIENTRY APIENTRY
- #endif // GL_APIENTRY
- #ifndef GL_HEADER_HAS_GLINT64
- typedef int64_t GLint64;
- #endif
- #ifndef GL_HEADER_HAS_GLUINT64
- typedef uint64_t GLuint64;
- #endif
- #ifdef OSG_GL_MATRICES_AVAILABLE
- inline void glLoadMatrix(const float* mat) { glLoadMatrixf(static_cast<const GLfloat*>(mat)); }
- inline void glMultMatrix(const float* mat) { glMultMatrixf(static_cast<const GLfloat*>(mat)); }
- #ifdef OSG_GLES1_AVAILABLE
- inline void glLoadMatrix(const double* mat)
- {
- GLfloat flt_mat[16];
- for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
- glLoadMatrixf(flt_mat);
- }
- inline void glMultMatrix(const double* mat)
- {
- GLfloat flt_mat[16];
- for(unsigned int i=0;i<16;++i) flt_mat[i] = mat[i];
- glMultMatrixf(flt_mat);
- }
- #else
- inline void glLoadMatrix(const double* mat) { glLoadMatrixd(static_cast<const GLdouble*>(mat)); }
- inline void glMultMatrix(const double* mat) { glMultMatrixd(static_cast<const GLdouble*>(mat)); }
- #endif
- #endif
- // add defines for OpenGL targets that don't define them, just to ease compatibility across targets
- #ifndef GL_DOUBLE
- #define GL_DOUBLE 0x140A
- typedef double GLdouble;
- #endif
- #ifndef GL_INT
- #define GL_INT 0x1404
- #endif
- #ifndef GL_UNSIGNED_INT
- #define GL_UNSIGNED_INT 0x1405
- #endif
- #ifndef GL_NONE
- // OpenGL ES1 doesn't provide GL_NONE
- #define GL_NONE 0x0
- #endif
- #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
- //GLES defines (OES)
- #define GL_RGB8_OES 0x8051
- #define GL_RGBA8_OES 0x8058
- #endif
- #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE) || defined(OSG_GL3_AVAILABLE)
- #define GL_POLYGON 0x0009
- #define GL_QUADS 0x0007
- #define GL_QUAD_STRIP 0x0008
- #endif
- #if defined(OSG_GL3_AVAILABLE)
- #define GL_LUMINANCE 0x1909
- #define GL_LUMINANCE_ALPHA 0x190A
- #endif
- #endif
|