diff --git a/CMakeLists.txt b/CMakeLists.txt index d7dff3c02..71b257a03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,10 @@ ELSE() ENDIF() ENDIF() + + + + IF(UNIX AND NOT ANDROID) # Not sure what this will do on Cygwin and Msys # Also, remember OS X X11 is a user installed option so it may not exist. @@ -450,28 +454,145 @@ MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS) OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON) -OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON) -OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON) -OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF) -OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF) -OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF) +# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings +SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL2, GL3, GLES1, GLES2") + +IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2")) + OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON ) +ELSE() + OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." OFF ) +ENDIF() + +IF ((OPENGL_PROFILE STREQUAL "GL2")) + OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON ) +ELSE() + OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." OFF ) +ENDIF() + +IF ((OPENGL_PROFILE STREQUAL "GL3") OR (OPENGL_PROFILE STREQUAL "GLCORE")) + OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." ON ) +ELSE() + OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF ) +ENDIF() + +IF ((OPENGL_PROFILE STREQUAL "GLES1")) + OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." ON ) +ELSE() + OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF ) +ENDIF() + +IF ((OPENGL_PROFILE STREQUAL "GLES2")) + OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON ) +ELSE() + OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF ) +ENDIF() + + OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF) SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.") -# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE}) -# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE}) -# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE}) -# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE}) -# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE}) +# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings +IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE) + OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF) + OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF) + OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF) + OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." OFF) + OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." OFF) +ELSEIF (OSG_GLES1_AVAILABLE) + OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF) + OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON) + OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON) + OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON) + OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON) +ELSE() + OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ON) + OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON) + OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON) + OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON) + OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON) +ENDIF() + +IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE) + OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF) +ELSE() + OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON) +ENDIF() + + +# Map the OSG_GL*_AVAILABLE settings to OpenGL header settings +IF (OSG_GL3_AVAILABLE) + IF (APPLE) + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "#include " CACHE STRING "#include<> line for additional OpenGL Headers if required") + ELSE() + + IF (OPENGL_PROFILE STREQUAL "GLCORE") + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ELSE() + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ENDIF() + + ENDIF() +ELSEIF(OSG_GLES1_AVAILABLE) + IF (APPLE) + SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "#include " CACHE STRING "#include<> line for additional OpenGL Headers if required") + ELSE() + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ENDIF() +ELSEIF(OSG_GLES2_AVAILABLE) + IF (APPLE) + SET(OPENGL_HEADER1 "#include \"TargetConditiona2s.h\"" CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "#include " CACHE STRING "#include<> line for additional OpenGL Headers if required") + ELSE() + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ENDIF() +ELSE() + IF (APPLE) + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ELSE() + SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") + SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required") + ENDIF() +ENDIF() + +IF (OSG_GL1_AVAILABLE) + SET(OSG_GL1_FEATURES "true") +ELSE() + SET(OSG_GL1_FEATURES "false") +ENDIF() + +IF (OSG_GL2_AVAILABLE) + SET(OSG_GL2_FEATURES "true") +ELSE() + SET(OSG_GL2_FEATURES "false") +ENDIF() + +IF (OSG_GL3_AVAILABLE) + SET(OSG_GL3_FEATURES "true") +ELSE() + SET(OSG_GL3_FEATURES "false") +ENDIF() + +IF (OSG_GLES1_AVAILABLE) + SET(OSG_GLES1_FEATURES "true") +ELSE() + SET(OSG_GLES1_FEATURES "false") +ENDIF() + +IF (OSG_GLES1_AVAILABLE) + SET(OSG_GLES2_FEATURES "true") +ELSE() + SET(OSG_GLES2_FEATURES "false") +ENDIF() -OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE}) -OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE}) -OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE}) -OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ${OSG_GL1_AVAILABLE}) -OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE}) -OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON) ################################################################################ # Set Config file @@ -484,6 +605,10 @@ SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Versi CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in" "${OPENSCENEGRAPH_VERSION_HEADER}") +SET(OPENSCENEGRAPH_OPENGGL_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/OpenGL") +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/OpenGL.in" + "${OPENSCENEGRAPH_OPENGGL_HEADER}") + # INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}") diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index 93cc88837..9593a3d07 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -90,7 +90,7 @@ public: if (!_extensionInitialized) setUpExtensions(); if (_glClientWaitSync) - { + { if (_previousSync) { unsigned int num_seconds = 1; @@ -114,11 +114,11 @@ public: typedef void (GL_APIENTRY * PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (GL_APIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64EXT timeout); typedef void (GL_APIENTRY * PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64EXT timeout); - typedef void (GL_APIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64EXT *params); + typedef void (GL_APIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); typedef void (GL_APIENTRY * PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); bool _extensionInitialized; - + PFNGLFENCESYNCPROC _glFenceSync; PFNGLISSYNCPROC _glIsSync; PFNGLDELETESYNCPROC _glDeleteSync; @@ -179,7 +179,7 @@ int main(int argc, char** argv) ); } } - + std::string device; while(arguments.read("--device", device)) { diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 64d327ed6..488663829 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -46,7 +46,6 @@ IF(DYNAMIC_OPENSCENEGRAPH) ADD_SUBDIRECTORY(osgfont) ADD_SUBDIRECTORY(osgforest) ADD_SUBDIRECTORY(osgfxbrowser) - ADD_SUBDIRECTORY(osgframerenderer) ADD_SUBDIRECTORY(osgoutline) ADD_SUBDIRECTORY(osggameoflife) ADD_SUBDIRECTORY(osggeometry) @@ -175,6 +174,7 @@ IF(DYNAMIC_OPENSCENEGRAPH) IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE) ADD_SUBDIRECTORY(osgscreencapture) + ADD_SUBDIRECTORY(osgframerenderer) ADD_SUBDIRECTORY(osgmotionblur) ADD_SUBDIRECTORY(osgteapot) ENDIF() diff --git a/include/osg/Drawable b/include/osg/Drawable index 96e427d01..fcb131ce8 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -657,8 +657,8 @@ class OSG_EXPORT Drawable : public Object void glDeleteQueries(GLsizei n, const GLuint *ids) const; void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params) const; void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) const; - void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) const; - void glGetInteger64v(GLenum pname, GLint64EXT *params) const; + void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params) const; + void glGetInteger64v(GLenum pname, GLint64 *params) const; protected: @@ -701,7 +701,7 @@ class OSG_EXPORT Drawable : public Object typedef void (GL_APIENTRY * EndOcclusionQueryProc) (); typedef void (GL_APIENTRY * GetOcclusionQueryivProc) ( GLuint id, GLenum pname, GLint *params ); typedef void (GL_APIENTRY * GetOcclusionQueryuivProc) ( GLuint id, GLenum pname, GLuint *params ); - typedef void (GL_APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64EXT *params ); + typedef void (GL_APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64 *params ); typedef void (GL_APIENTRY *GenQueriesProc) (GLsizei n, GLuint *ids); typedef void (GL_APIENTRY *DeleteQueriesProc) (GLsizei n, const GLuint *ids); @@ -712,8 +712,8 @@ class OSG_EXPORT Drawable : public Object typedef void (GL_APIENTRY *GetQueryivProc) (GLenum target, GLenum pname, GLint *params); typedef void (GL_APIENTRY *GetQueryObjectivProc) (GLuint id, GLenum pname, GLint *params); typedef void (GL_APIENTRY *GetQueryObjectuivProc) (GLuint id, GLenum pname, GLuint *params); - typedef void (GL_APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64EXT *params); - typedef void (GL_APIENTRY *GetInteger64vProc) (GLenum pname, GLint64EXT *params); + typedef void (GL_APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64 *params); + typedef void (GL_APIENTRY *GetInteger64vProc) (GLenum pname, GLint64 *params); ~Extensions() {} diff --git a/include/osg/GL b/include/osg/GL index 7d6093062..3e0a126ee 100644 --- a/include/osg/GL +++ b/include/osg/GL @@ -14,9 +14,17 @@ #ifndef OSG_GL #define OSG_GL 1 +#if 1 + +#include + +#else + + #include #include + #if defined(OSG_GLES1_AVAILABLE) #ifdef __APPLE__ @@ -244,4 +252,6 @@ #endif +#endif + #endif // __osgGL_h diff --git a/include/osg/State b/include/osg/State index 9c351c534..6e4b15da1 100644 --- a/include/osg/State +++ b/include/osg/State @@ -1495,9 +1495,9 @@ class OSG_EXPORT State : public Referenced, public Observer { return osg::Timer::instance()->delta_s(_startTick, _gpuTick); } - GLuint64EXT getGpuTimestamp() const { return _gpuTimestamp; } + GLuint64 getGpuTimestamp() const { return _gpuTimestamp; } - void setGpuTimestamp(Timer_t tick, GLuint64EXT timestamp) + void setGpuTimestamp(Timer_t tick, GLuint64 timestamp) { _gpuTick = tick; _gpuTimestamp = timestamp; @@ -1930,8 +1930,8 @@ class OSG_EXPORT State : public Referenced, public Observer Timer_t _startTick; Timer_t _gpuTick; - GLuint64EXT _gpuTimestamp; - int _timestampBits; + GLuint64 _gpuTimestamp; + int _timestampBits; }; inline void State::pushModeList(ModeMap& modeMap,const StateSet::ModeList& modeList) diff --git a/include/osgQt/GraphicsWindowQt b/include/osgQt/GraphicsWindowQt index 3e6e1596f..b6adef265 100644 --- a/include/osgQt/GraphicsWindowQt +++ b/include/osgQt/GraphicsWindowQt @@ -14,6 +14,8 @@ #ifndef OSGVIEWER_GRAPHICSWINDOWQT #define OSGVIEWER_GRAPHICSWINDOWQT +#include + #include #include @@ -21,7 +23,6 @@ #include #include #include -#include class QInputEvent; diff --git a/include/osgQt/QGraphicsViewAdapter b/include/osgQt/QGraphicsViewAdapter index 0458a005a..7b9659ac1 100644 --- a/include/osgQt/QGraphicsViewAdapter +++ b/include/osgQt/QGraphicsViewAdapter @@ -14,6 +14,8 @@ #ifndef QGRAPHICSVIEWADAPTER #define QGRAPHICSVIEWADAPTER +#include + #include #include #include diff --git a/include/osgQt/QWidgetImage b/include/osgQt/QWidgetImage index c98f390fe..8f1dd851b 100644 --- a/include/osgQt/QWidgetImage +++ b/include/osgQt/QWidgetImage @@ -14,8 +14,8 @@ #ifndef QWIDGETIMAGE #define QWIDGETIMAGE -#include #include +#include namespace osgQt { diff --git a/src/osg/Config.in b/src/osg/Config.in index c9ec120a6..0bc618c14 100644 --- a/src/osg/Config.in +++ b/src/osg/Config.in @@ -32,16 +32,4 @@ #cmakedefine OSG_USE_UTF8_FILENAME #cmakedefine OSG_DISABLE_MSVC_WARNINGS -#cmakedefine OSG_GL1_AVAILABLE -#cmakedefine OSG_GL2_AVAILABLE -#cmakedefine OSG_GL3_AVAILABLE -#cmakedefine OSG_GLES1_AVAILABLE -#cmakedefine OSG_GLES2_AVAILABLE -#cmakedefine OSG_GL_LIBRARY_STATIC -#cmakedefine OSG_GL_DISPLAYLISTS_AVAILABLE -#cmakedefine OSG_GL_MATRICES_AVAILABLE -#cmakedefine OSG_GL_VERTEX_FUNCS_AVAILABLE -#cmakedefine OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE -#cmakedefine OSG_GL_FIXED_FUNCTION_AVAILABLE - #endif diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 6714dc62e..085aa30fa 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -1516,7 +1516,7 @@ void Drawable::Extensions::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint * OSG_WARN << "Error: glGetQueryObjectuiv not supported by OpenGL driver" << std::endl; } -void Drawable::Extensions::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) const +void Drawable::Extensions::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params) const { if (_gl_get_query_objectui64v) _gl_get_query_objectui64v(id, pname, params); @@ -1524,7 +1524,7 @@ void Drawable::Extensions::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint OSG_WARN << "Error: glGetQueryObjectui64v not supported by OpenGL driver" << std::endl; } -void Drawable::Extensions::glGetInteger64v(GLenum pname, GLint64EXT *params) +void Drawable::Extensions::glGetInteger64v(GLenum pname, GLint64 *params) const { if (_glGetInteger64v) diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 62d8c7e2c..43e6a7a63 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1785,7 +1785,7 @@ void State::frameCompleted() osg::Drawable::Extensions* extensions = osg::Drawable::getExtensions(getContextID(), true); if (extensions && getTimestampBits()) { - GLint64EXT timestamp; + GLint64 timestamp; extensions->glGetInteger64v(GL_TIMESTAMP, ×tamp); setGpuTimestamp(osg::Timer::instance()->tick(), timestamp); //OSG_NOTICE<<"State::frameCompleted() setting time stamp. timestamp="< #include + +#include #include #include