From 4994b806d2b5c6ea1b790df990557f3836f84ad1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 25 Apr 2014 08:57:27 +0000 Subject: [PATCH] From Pjotr Svetachov, "For me osgviewer.cpp and Renderer.cpp were not compiling (visual studio 2013 with profile GL2) because they were still using GLuintEXT. So I changed that, see the attached files. I also noticed that the generated OpenGL header were not copied to the installation directory so my own application could not find it." --- applications/osgviewer/osgviewer.cpp | 6 +++--- src/osg/CMakeLists.txt | 1 + src/osgViewer/Renderer.cpp | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index 9593a3d07..cec9a5f7c 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -94,7 +94,7 @@ public: if (_previousSync) { unsigned int num_seconds = 1; - GLuint64EXT timeout = num_seconds * ((GLuint64EXT)1000 * 1000 * 1000); + GLuint64 timeout = num_seconds * ((GLuint64)1000 * 1000 * 1000); _glClientWaitSync(_previousSync, 0, timeout); _glDeleteSync(_previousSync); @@ -112,8 +112,8 @@ public: typedef GLsync (GL_APIENTRY * PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); typedef GLboolean (GL_APIENTRY * PFNGLISSYNCPROC) (GLsync sync); 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 GLenum (GL_APIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); + typedef void (GL_APIENTRY * PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (GL_APIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); typedef void (GL_APIENTRY * PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index b2b39e2e9..76eb9588b 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -210,6 +210,7 @@ SET(TARGET_H ${HEADER_PATH}/View ${HEADER_PATH}/Viewport ${OPENSCENEGRAPH_CONFIG_HEADER} + ${OPENSCENEGRAPH_OPENGL_HEADER} ) #ADD_LIBRARY(${LIB_NAME} diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index 3ee06e940..b864d39eb 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -77,7 +77,7 @@ void EXTQuerySupport::checkQuery(osg::Stats* stats, osg::State* /*state*/, _extensions->glGetQueryObjectiv(query, GL_QUERY_RESULT_AVAILABLE, &available); if (available) { - GLuint64EXT timeElapsed = 0; + GLuint64 timeElapsed = 0; _extensions->glGetQueryObjectui64v(query, GL_QUERY_RESULT, &timeElapsed); double timeElapsedSeconds = double(timeElapsed)*1e-9; @@ -214,13 +214,13 @@ void ARBQuerySupport::checkQuery(osg::Stats* stats, osg::State* state, if (available) { QueryPair queries = itr->queries; - GLuint64EXT beginTimestamp = 0; - GLuint64EXT endTimestamp = 0; + GLuint64 beginTimestamp = 0; + GLuint64 endTimestamp = 0; _extensions->glGetQueryObjectui64v(queries.first, GL_QUERY_RESULT, &beginTimestamp); _extensions->glGetQueryObjectui64v(queries.second, GL_QUERY_RESULT, &endTimestamp); - GLuint64EXT gpuTimestamp = state->getGpuTimestamp(); + GLuint64 gpuTimestamp = state->getGpuTimestamp(); // Have any of the timestamps wrapped around? int tbits = state->getTimestampBits(); if (tbits < 64) @@ -228,11 +228,11 @@ void ARBQuerySupport::checkQuery(osg::Stats* stats, osg::State* state, // If the high bits on any of the timestamp bits are // different then the counters may have wrapped. const int hiShift = (tbits - 1); - const GLuint64EXT hiMask = 1 << hiShift; - const GLuint64EXT sum = (beginTimestamp >> hiShift) + const GLuint64 hiMask = 1 << hiShift; + const GLuint64 sum = (beginTimestamp >> hiShift) + (endTimestamp >> hiShift) + (gpuTimestamp >> hiShift); if (sum == 1 || sum == 2) { - const GLuint64EXT wrapAdd = 1 << tbits; + const GLuint64 wrapAdd = 1 << tbits; // Counter wrapped between begin and end? if (beginTimestamp > endTimestamp) { @@ -251,7 +251,7 @@ void ARBQuerySupport::checkQuery(osg::Stats* stats, osg::State* state, } } } - GLuint64EXT timeElapsed = endTimestamp - beginTimestamp; + GLuint64 timeElapsed = endTimestamp - beginTimestamp; double timeElapsedSeconds = double(timeElapsed)*1e-9; double gpuTick = state->getGpuTime(); double beginTime = 0.0;