mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor to deprecate existing QGLWidget derived widget
Renamed cvfqt::OpenGLWidget to cvfqt::GLWidget_deprecated Renamed cvfqt::CvfBoundQGLContext to cvfqt::CvfBoundQGLContext_deprecated Renamed cvfqt::OpenGLContext to cvfqt::OpenGLContext_QGLContextAdapter_deprecated Added cvf::OpenGLUtils
This commit is contained in:
parent
ce9a65ee41
commit
5d625223c1
@ -37,7 +37,7 @@
|
|||||||
#include "cafOpenGLWidget.h"
|
#include "cafOpenGLWidget.h"
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfOpenGLContextGroup.h"
|
#include "cvfOpenGLContextGroup.h"
|
||||||
#include "cvfqtCvfBoundQGLContext.h"
|
#include "cvfqtCvfBoundQGLContext_deprecated.h"
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ OpenGLWidget::OpenGLWidget( cvf::OpenGLContextGroup* contextGroup,
|
|||||||
QWidget* parent,
|
QWidget* parent,
|
||||||
OpenGLWidget* shareWidget,
|
OpenGLWidget* shareWidget,
|
||||||
Qt::WindowFlags f )
|
Qt::WindowFlags f )
|
||||||
: QGLWidget( new cvfqt::CvfBoundQGLContext( contextGroup, format ), parent, shareWidget, f )
|
: QGLWidget( new cvfqt::CvfBoundQGLContext_deprecated( contextGroup, format ), parent, shareWidget, f )
|
||||||
{
|
{
|
||||||
if ( isValid() )
|
if ( isValid() )
|
||||||
{
|
{
|
||||||
@ -106,7 +106,7 @@ OpenGLWidget::OpenGLWidget( cvf::OpenGLContextGroup* contextGroup,
|
|||||||
/// If the context is not valid, sharing failed and the newly created widget/context be discarded.
|
/// If the context is not valid, sharing failed and the newly created widget/context be discarded.
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
OpenGLWidget::OpenGLWidget( OpenGLWidget* shareWidget, QWidget* parent, Qt::WindowFlags f )
|
OpenGLWidget::OpenGLWidget( OpenGLWidget* shareWidget, QWidget* parent, Qt::WindowFlags f )
|
||||||
: QGLWidget( new cvfqt::CvfBoundQGLContext( shareWidget->cvfOpenGLContext()->group(), shareWidget->format() ),
|
: QGLWidget( new cvfqt::CvfBoundQGLContext_deprecated( shareWidget->cvfOpenGLContext()->group(), shareWidget->format() ),
|
||||||
parent,
|
parent,
|
||||||
shareWidget,
|
shareWidget,
|
||||||
f )
|
f )
|
||||||
@ -145,7 +145,7 @@ OpenGLWidget::OpenGLWidget( OpenGLWidget* shareWidget, QWidget* parent, Qt::Wind
|
|||||||
cvf::OpenGLContext* OpenGLWidget::cvfOpenGLContext() const
|
cvf::OpenGLContext* OpenGLWidget::cvfOpenGLContext() const
|
||||||
{
|
{
|
||||||
const QGLContext* qglContext = context();
|
const QGLContext* qglContext = context();
|
||||||
const cvfqt::CvfBoundQGLContext* contextBinding = dynamic_cast<const cvfqt::CvfBoundQGLContext*>( qglContext );
|
const cvfqt::CvfBoundQGLContext_deprecated* contextBinding = dynamic_cast<const cvfqt::CvfBoundQGLContext_deprecated*>( qglContext );
|
||||||
CVF_ASSERT( contextBinding );
|
CVF_ASSERT( contextBinding );
|
||||||
|
|
||||||
return contextBinding->cvfOpenGLContext();
|
return contextBinding->cvfOpenGLContext();
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "cvfModel.h"
|
#include "cvfModel.h"
|
||||||
#include "cvfOpenGLCapabilities.h"
|
#include "cvfOpenGLCapabilities.h"
|
||||||
#include "cvfOpenGLResourceManager.h"
|
#include "cvfOpenGLResourceManager.h"
|
||||||
|
#include "cvfOpenGLUtils.h"
|
||||||
#include "cvfOverlayImage.h"
|
#include "cvfOverlayImage.h"
|
||||||
#include "cvfPart.h"
|
#include "cvfPart.h"
|
||||||
#include "cvfRay.h"
|
#include "cvfRay.h"
|
||||||
@ -69,7 +70,6 @@
|
|||||||
#include "cvfUniform.h"
|
#include "cvfUniform.h"
|
||||||
#include "cvfUniformSet.h"
|
#include "cvfUniformSet.h"
|
||||||
|
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
#include "cvfqtPerformanceInfoHud.h"
|
#include "cvfqtPerformanceInfoHud.h"
|
||||||
#include "cvfqtUtils.h"
|
#include "cvfqtUtils.h"
|
||||||
|
|
||||||
@ -850,7 +850,7 @@ void caf::Viewer::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
if ( isShadersSupported() )
|
if ( isShadersSupported() )
|
||||||
{
|
{
|
||||||
cvfqt::OpenGLContext::saveOpenGLState( myOglContext.p() );
|
cvf::OpenGLUtils::pushOpenGLState( myOglContext.p() );
|
||||||
}
|
}
|
||||||
|
|
||||||
optimizeClippingPlanes();
|
optimizeClippingPlanes();
|
||||||
@ -880,7 +880,7 @@ void caf::Viewer::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
if ( isShadersSupported() )
|
if ( isShadersSupported() )
|
||||||
{
|
{
|
||||||
cvfqt::OpenGLContext::restoreOpenGLState( myOglContext.p() );
|
cvf::OpenGLUtils::popOpenGLState( myOglContext.p() );
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.endNativePainting();
|
painter.endNativePainting();
|
||||||
|
@ -20,22 +20,20 @@ set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
|
|||||||
|
|
||||||
set(CEE_HEADER_FILES
|
set(CEE_HEADER_FILES
|
||||||
cvfqtBasicAboutDialog.h
|
cvfqtBasicAboutDialog.h
|
||||||
cvfqtCvfBoundQGLContext.h
|
|
||||||
cvfqtMouseState.h
|
cvfqtMouseState.h
|
||||||
cvfqtOpenGLContext.h
|
|
||||||
cvfqtOpenGLWidget.h
|
|
||||||
cvfqtPerformanceInfoHud.h
|
cvfqtPerformanceInfoHud.h
|
||||||
cvfqtUtils.h
|
cvfqtUtils.h
|
||||||
|
cvfqtCvfBoundQGLContext_deprecated.h
|
||||||
|
cvfqtGLWidget_deprecated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CEE_SOURCE_FILES
|
set(CEE_SOURCE_FILES
|
||||||
cvfqtBasicAboutDialog.cpp
|
cvfqtBasicAboutDialog.cpp
|
||||||
cvfqtCvfBoundQGLContext.cpp
|
|
||||||
cvfqtMouseState.cpp
|
cvfqtMouseState.cpp
|
||||||
cvfqtOpenGLContext.cpp
|
|
||||||
cvfqtOpenGLWidget.cpp
|
|
||||||
cvfqtPerformanceInfoHud.cpp
|
cvfqtPerformanceInfoHud.cpp
|
||||||
cvfqtUtils.cpp
|
cvfqtUtils.cpp
|
||||||
|
cvfqtCvfBoundQGLContext_deprecated.cpp
|
||||||
|
cvfqtGLWidget_deprecated.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})
|
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})
|
||||||
@ -58,6 +56,6 @@ source_group("" FILES ${PROJECT_FILES})
|
|||||||
|
|
||||||
# Unity Build
|
# Unity Build
|
||||||
if (CMAKE_UNITY_BUILD)
|
if (CMAKE_UNITY_BUILD)
|
||||||
set_source_files_properties (cvfqtOpenGLWidget.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
set_source_files_properties (cvfqtGLWidget_deprecated.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||||
set_source_files_properties (cvfqtOpenGLContext.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
set_source_files_properties (cvfqtOpenGLContext.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
//##################################################################################################
|
|
||||||
//
|
|
||||||
// Custom Visualization Core library
|
|
||||||
// Copyright (C) 2011-2013 Ceetron AS
|
|
||||||
//
|
|
||||||
// This library may be used under the terms of either the GNU General Public License or
|
|
||||||
// the GNU Lesser General Public License as follows:
|
|
||||||
//
|
|
||||||
// GNU General Public License Usage
|
|
||||||
// This library is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// 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 GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
// GNU Lesser General Public License Usage
|
|
||||||
// This library is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// 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 GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
|
||||||
// for more details.
|
|
||||||
//
|
|
||||||
//##################################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
#include "cvfBase.h"
|
|
||||||
#include "cvfqtCvfBoundQGLContext.h"
|
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
|
|
||||||
namespace cvfqt {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
|
||||||
///
|
|
||||||
/// \class cvfqt::CvfBoundQGLContext
|
|
||||||
/// \ingroup GuiQt
|
|
||||||
///
|
|
||||||
///
|
|
||||||
///
|
|
||||||
//==================================================================================================
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
CvfBoundQGLContext::CvfBoundQGLContext(cvf::OpenGLContextGroup* contextGroup, const QGLFormat & format)
|
|
||||||
: QGLContext(format)
|
|
||||||
{
|
|
||||||
m_cvfGLContext = new OpenGLContext(contextGroup, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
CvfBoundQGLContext::~CvfBoundQGLContext()
|
|
||||||
{
|
|
||||||
if (m_cvfGLContext.notNull())
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
// Need to resolve the case where the Qt QGLcontext (that we're deriving from) is deleted
|
|
||||||
// and we are still holding a reference to one or more OpenGLContext objects
|
|
||||||
// By the time we get here we expect that we're holding the only reference
|
|
||||||
CVF_ASSERT(m_cvfGLContext->refCount() == 1);
|
|
||||||
m_cvfGLContext = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
cvf::OpenGLContext* CvfBoundQGLContext::cvfOpenGLContext() const
|
|
||||||
{
|
|
||||||
return const_cast<cvf::OpenGLContext*>(m_cvfGLContext.p());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace cvfqt
|
|
||||||
|
|
||||||
|
|
@ -36,12 +36,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfOpenGL.h"
|
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
#include "cvfqtCvfBoundQGLContext.h"
|
|
||||||
|
|
||||||
#include "cvfOpenGLContextGroup.h"
|
|
||||||
#include "cvfOpenGLCapabilities.h"
|
#include "cvfOpenGLCapabilities.h"
|
||||||
|
#include "cvfqtCvfBoundQGLContext_deprecated.h"
|
||||||
|
|
||||||
namespace cvfqt {
|
namespace cvfqt {
|
||||||
|
|
||||||
@ -49,7 +45,7 @@ namespace cvfqt {
|
|||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
/// \class cvfqt::OpenGLContext
|
/// \class cvfqt::OpenGLContext_QGLContextAdapter_deprecated
|
||||||
/// \ingroup GuiQt
|
/// \ingroup GuiQt
|
||||||
///
|
///
|
||||||
/// Derived OpenGLContext that adapts a Qt QGLContext
|
/// Derived OpenGLContext that adapts a Qt QGLContext
|
||||||
@ -59,7 +55,7 @@ namespace cvfqt {
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
OpenGLContext::OpenGLContext(cvf::OpenGLContextGroup* contextGroup, QGLContext* backingQGLContext)
|
OpenGLContext_QGLContextAdapter_deprecated::OpenGLContext_QGLContextAdapter_deprecated(cvf::OpenGLContextGroup* contextGroup, QGLContext* backingQGLContext)
|
||||||
: cvf::OpenGLContext(contextGroup),
|
: cvf::OpenGLContext(contextGroup),
|
||||||
m_isCoreOpenGLProfile(false),
|
m_isCoreOpenGLProfile(false),
|
||||||
m_majorVersion(0),
|
m_majorVersion(0),
|
||||||
@ -78,7 +74,7 @@ OpenGLContext::OpenGLContext(cvf::OpenGLContextGroup* contextGroup, QGLContext*
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
OpenGLContext::~OpenGLContext()
|
OpenGLContext_QGLContextAdapter_deprecated::~OpenGLContext_QGLContextAdapter_deprecated()
|
||||||
{
|
{
|
||||||
m_qtGLContext = NULL;
|
m_qtGLContext = NULL;
|
||||||
}
|
}
|
||||||
@ -87,7 +83,7 @@ OpenGLContext::~OpenGLContext()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool OpenGLContext::initializeContext()
|
bool OpenGLContext_QGLContextAdapter_deprecated::initializeContext()
|
||||||
{
|
{
|
||||||
if (!cvf::OpenGLContext::initializeContext())
|
if (!cvf::OpenGLContext::initializeContext())
|
||||||
{
|
{
|
||||||
@ -107,7 +103,7 @@ bool OpenGLContext::initializeContext()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void OpenGLContext::makeCurrent()
|
void OpenGLContext_QGLContextAdapter_deprecated::makeCurrent()
|
||||||
{
|
{
|
||||||
CVF_ASSERT(m_qtGLContext);
|
CVF_ASSERT(m_qtGLContext);
|
||||||
m_qtGLContext->makeCurrent();
|
m_qtGLContext->makeCurrent();
|
||||||
@ -117,7 +113,7 @@ void OpenGLContext::makeCurrent()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool OpenGLContext::isCurrent() const
|
bool OpenGLContext_QGLContextAdapter_deprecated::isCurrent() const
|
||||||
{
|
{
|
||||||
if (m_qtGLContext)
|
if (m_qtGLContext)
|
||||||
{
|
{
|
||||||
@ -131,93 +127,50 @@ bool OpenGLContext::isCurrent() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
/// \class cvfqt::CvfBoundQGLContext_deprecated
|
||||||
|
/// \ingroup GuiQt
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Make an effort to save current OpenGL state. Must be matched by a call to restoreOpenGLState()
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void OpenGLContext::saveOpenGLState(cvf::OpenGLContext* oglContext)
|
CvfBoundQGLContext_deprecated::CvfBoundQGLContext_deprecated(cvf::OpenGLContextGroup* contextGroup, const QGLFormat & format)
|
||||||
|
: QGLContext(format)
|
||||||
{
|
{
|
||||||
CVF_CALLSITE_OPENGL(oglContext);
|
m_cvfGLContext = new OpenGLContext_QGLContextAdapter_deprecated(contextGroup, this);
|
||||||
const cvf::OpenGLCapabilities* oglCaps = oglContext->capabilities();
|
|
||||||
|
|
||||||
// Only relevant for fixed function
|
|
||||||
if (!oglCaps->supportsFixedFunction())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
// For now disable pushing of the vertex array related attributes as it gives a mystical
|
|
||||||
// crash on Redhat5 under VMWare. Not a big issue, but maybe we can do without this push?
|
|
||||||
//glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
// Note: Only preserves matrix stack for texture unit 0
|
|
||||||
if (oglCaps->supportsOpenGL2())
|
|
||||||
{
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
glMatrixMode(GL_TEXTURE);
|
|
||||||
glPushMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Restore OpenGL state that has been saved by saveOpenGLState()
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void OpenGLContext::restoreOpenGLState(cvf::OpenGLContext* oglContext)
|
CvfBoundQGLContext_deprecated::~CvfBoundQGLContext_deprecated()
|
||||||
{
|
{
|
||||||
CVF_CALLSITE_OPENGL(oglContext);
|
if (m_cvfGLContext.notNull())
|
||||||
const cvf::OpenGLCapabilities* oglCaps = oglContext->capabilities();
|
|
||||||
|
|
||||||
// Only relevant for fixed function
|
|
||||||
if (!oglCaps->supportsFixedFunction())
|
|
||||||
{
|
{
|
||||||
return;
|
// TODO
|
||||||
|
// Need to resolve the case where the Qt QGLcontext (that we're deriving from) is deleted
|
||||||
|
// and we are still holding a reference to one or more OpenGLContext objects
|
||||||
|
// By the time we get here we expect that we're holding the only reference
|
||||||
|
CVF_ASSERT(m_cvfGLContext->refCount() == 1);
|
||||||
|
m_cvfGLContext = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
// Note: Only preserves matrix stack for texture unit 0
|
//--------------------------------------------------------------------------------------------------
|
||||||
if (oglCaps->supportsOpenGL2())
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::OpenGLContext* CvfBoundQGLContext_deprecated::cvfOpenGLContext() const
|
||||||
{
|
{
|
||||||
glActiveTexture(GL_TEXTURE0);
|
return const_cast<cvf::OpenGLContext*>(m_cvfGLContext.p());
|
||||||
}
|
|
||||||
glMatrixMode(GL_TEXTURE);
|
|
||||||
glPopMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPopMatrix();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
glPopAttrib();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
|
|
||||||
// Currently not pushing vertex attribs, so comment out the pop
|
|
||||||
//glPopClientAttrib();
|
|
||||||
|
|
||||||
glPopClientAttrib();
|
|
||||||
CVF_CHECK_OGL(oglContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "cvfOpenGLContext.h"
|
#include "cvfOpenGLContext.h"
|
||||||
|
|
||||||
class QGLContext;
|
#include <QGLContext>
|
||||||
|
|
||||||
namespace cvfqt {
|
namespace cvfqt {
|
||||||
|
|
||||||
@ -49,20 +49,17 @@ namespace cvfqt {
|
|||||||
// Derived OpenGLContext that adapts a Qt QGLContext
|
// Derived OpenGLContext that adapts a Qt QGLContext
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class OpenGLContext : public cvf::OpenGLContext
|
class OpenGLContext_QGLContextAdapter_deprecated : public cvf::OpenGLContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpenGLContext(cvf::OpenGLContextGroup* contextGroup, QGLContext* backingQGLContext);
|
OpenGLContext_QGLContextAdapter_deprecated(cvf::OpenGLContextGroup* contextGroup, QGLContext* backingQGLContext);
|
||||||
virtual ~OpenGLContext();
|
virtual ~OpenGLContext_QGLContextAdapter_deprecated();
|
||||||
|
|
||||||
virtual bool initializeContext();
|
virtual bool initializeContext();
|
||||||
|
|
||||||
virtual void makeCurrent();
|
virtual void makeCurrent();
|
||||||
virtual bool isCurrent() const;
|
virtual bool isCurrent() const;
|
||||||
|
|
||||||
static void saveOpenGLState(cvf::OpenGLContext* oglContext);
|
|
||||||
static void restoreOpenGLState(cvf::OpenGLContext* oglContext);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGLContext* m_qtGLContext;
|
QGLContext* m_qtGLContext;
|
||||||
bool m_isCoreOpenGLProfile; // This is a Core OpenGL profile. Implies OpenGL version of 3.2 or more
|
bool m_isCoreOpenGLProfile; // This is a Core OpenGL profile. Implies OpenGL version of 3.2 or more
|
||||||
@ -70,4 +67,23 @@ private:
|
|||||||
int m_minorVersion;
|
int m_minorVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
// Utility class used to piggyback OpenGLContext onto Qt's QGLContext
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
class CvfBoundQGLContext_deprecated : public QGLContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CvfBoundQGLContext_deprecated(cvf::OpenGLContextGroup* contextGroup, const QGLFormat & format);
|
||||||
|
virtual ~CvfBoundQGLContext_deprecated();
|
||||||
|
|
||||||
|
cvf::OpenGLContext* cvfOpenGLContext() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cvf::ref<cvf::OpenGLContext> m_cvfGLContext;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfOpenGLContextGroup.h"
|
#include "cvfOpenGLContextGroup.h"
|
||||||
#include "cvfqtCvfBoundQGLContext.h"
|
#include "cvfqtCvfBoundQGLContext_deprecated.h"
|
||||||
#include "cvfqtOpenGLWidget.h"
|
#include "cvfqtGLWidget_deprecated.h"
|
||||||
|
|
||||||
namespace cvfqt {
|
namespace cvfqt {
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ namespace cvfqt {
|
|||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
/// \class cvfqt::OpenGLWidget
|
/// \class cvfqt::GLWidget_deprecated
|
||||||
/// \ingroup GuiQt
|
/// \ingroup GuiQt
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@ -56,8 +56,8 @@ namespace cvfqt {
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
OpenGLWidget::OpenGLWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent, Qt::WindowFlags f)
|
GLWidget_deprecated::GLWidget_deprecated(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent, Qt::WindowFlags f)
|
||||||
: QGLWidget(new CvfBoundQGLContext(contextGroup, format), parent, NULL, f)
|
: QGLWidget(new CvfBoundQGLContext_deprecated(contextGroup, format), parent, NULL, f)
|
||||||
{
|
{
|
||||||
// This constructor can only be used with an empty context group!
|
// This constructor can only be used with an empty context group!
|
||||||
// We're not able to check this up front, but assert that the count is 1 by the time we get here
|
// We're not able to check this up front, but assert that the count is 1 by the time we get here
|
||||||
@ -86,8 +86,8 @@ OpenGLWidget::OpenGLWidget(cvf::OpenGLContextGroup* contextGroup, const QGLForma
|
|||||||
///
|
///
|
||||||
/// If the context is not valid, sharing failed and the newly created widget/context be discarded.
|
/// If the context is not valid, sharing failed and the newly created widget/context be discarded.
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
OpenGLWidget::OpenGLWidget(OpenGLWidget* shareWidget, QWidget* parent , Qt::WindowFlags f)
|
GLWidget_deprecated::GLWidget_deprecated(GLWidget_deprecated* shareWidget, QWidget* parent , Qt::WindowFlags f)
|
||||||
: QGLWidget(new CvfBoundQGLContext(shareWidget->cvfOpenGLContext()->group(), shareWidget->format()), parent, shareWidget, f)
|
: QGLWidget(new CvfBoundQGLContext_deprecated(shareWidget->cvfOpenGLContext()->group(), shareWidget->format()), parent, shareWidget, f)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(shareWidget);
|
CVF_ASSERT(shareWidget);
|
||||||
cvf::ref<cvf::OpenGLContext> shareContext = shareWidget->cvfOpenGLContext();
|
cvf::ref<cvf::OpenGLContext> shareContext = shareWidget->cvfOpenGLContext();
|
||||||
@ -120,10 +120,10 @@ OpenGLWidget::OpenGLWidget(OpenGLWidget* shareWidget, QWidget* parent , Qt::Wind
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::OpenGLContext* OpenGLWidget::cvfOpenGLContext() const
|
cvf::OpenGLContext* GLWidget_deprecated::cvfOpenGLContext() const
|
||||||
{
|
{
|
||||||
const QGLContext* qglContext = context();
|
const QGLContext* qglContext = context();
|
||||||
const CvfBoundQGLContext* contextBinding = dynamic_cast<const CvfBoundQGLContext*>(qglContext);
|
const CvfBoundQGLContext_deprecated* contextBinding = dynamic_cast<const CvfBoundQGLContext_deprecated*>(qglContext);
|
||||||
CVF_ASSERT(contextBinding);
|
CVF_ASSERT(contextBinding);
|
||||||
|
|
||||||
return contextBinding->cvfOpenGLContext();
|
return contextBinding->cvfOpenGLContext();
|
||||||
@ -133,7 +133,7 @@ cvf::OpenGLContext* OpenGLWidget::cvfOpenGLContext() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void OpenGLWidget::cvfShutdownOpenGLContext()
|
void GLWidget_deprecated::cvfShutdownOpenGLContext()
|
||||||
{
|
{
|
||||||
// It should be safe to call shutdown multiple times so this call should
|
// It should be safe to call shutdown multiple times so this call should
|
||||||
// amount to a no-op if the user has already shut down the context
|
// amount to a no-op if the user has already shut down the context
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtOpenGL/QGLWidget>
|
#include <QGLWidget>
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
@ -53,11 +53,11 @@ namespace cvfqt {
|
|||||||
// Derived QGLWidget
|
// Derived QGLWidget
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class OpenGLWidget : public QGLWidget
|
class GLWidget_deprecated : public QGLWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpenGLWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent, Qt::WindowFlags f = 0);
|
GLWidget_deprecated(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent, Qt::WindowFlags f = 0);
|
||||||
OpenGLWidget(OpenGLWidget* shareWidget, QWidget* parent , Qt::WindowFlags f = 0);
|
GLWidget_deprecated(GLWidget_deprecated* shareWidget, QWidget* parent , Qt::WindowFlags f = 0);
|
||||||
|
|
||||||
cvf::OpenGLContext* cvfOpenGLContext() const;
|
cvf::OpenGLContext* cvfOpenGLContext() const;
|
||||||
void cvfShutdownOpenGLContext();
|
void cvfShutdownOpenGLContext();
|
@ -47,6 +47,7 @@ cvfOpenGLContext.h
|
|||||||
cvfOpenGLContextGroup.h
|
cvfOpenGLContextGroup.h
|
||||||
cvfOpenGLResourceManager.h
|
cvfOpenGLResourceManager.h
|
||||||
cvfOpenGLTypes.h
|
cvfOpenGLTypes.h
|
||||||
|
cvfOpenGLUtils.h
|
||||||
cvfOverlayAxisCross.h
|
cvfOverlayAxisCross.h
|
||||||
cvfOverlayScalarMapperLegend.h
|
cvfOverlayScalarMapperLegend.h
|
||||||
cvfOverlayColorLegend.h
|
cvfOverlayColorLegend.h
|
||||||
@ -123,6 +124,7 @@ cvfOpenGLCapabilities.cpp
|
|||||||
cvfOpenGLContext.cpp
|
cvfOpenGLContext.cpp
|
||||||
cvfOpenGLContextGroup.cpp
|
cvfOpenGLContextGroup.cpp
|
||||||
cvfOpenGLResourceManager.cpp
|
cvfOpenGLResourceManager.cpp
|
||||||
|
cvfOpenGLUtils.cpp
|
||||||
cvfOpenGL.cpp
|
cvfOpenGL.cpp
|
||||||
cvfOverlayAxisCross.cpp
|
cvfOverlayAxisCross.cpp
|
||||||
cvfOverlayScalarMapperLegend.cpp
|
cvfOverlayScalarMapperLegend.cpp
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include "cvfOpenGLContextGroup.h"
|
#include "cvfOpenGLContextGroup.h"
|
||||||
#include "cvfOpenGLResourceManager.h"
|
#include "cvfOpenGLResourceManager.h"
|
||||||
#include "cvfOpenGLTypes.h"
|
#include "cvfOpenGLTypes.h"
|
||||||
|
#include "cvfOpenGLUtils.h"
|
||||||
#include "cvfOverlayAxisCross.h"
|
#include "cvfOverlayAxisCross.h"
|
||||||
#include "cvfOverlayColorLegend.h"
|
#include "cvfOverlayColorLegend.h"
|
||||||
#include "cvfOverlayImage.h"
|
#include "cvfOverlayImage.h"
|
||||||
|
152
Fwk/VizFwk/LibRender/cvfOpenGLUtils.cpp
Normal file
152
Fwk/VizFwk/LibRender/cvfOpenGLUtils.cpp
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Custom Visualization Core library
|
||||||
|
// Copyright (C) 2011-2013 Ceetron AS
|
||||||
|
//
|
||||||
|
// This library may be used under the terms of either the GNU General Public License or
|
||||||
|
// the GNU Lesser General Public License as follows:
|
||||||
|
//
|
||||||
|
// GNU General Public License Usage
|
||||||
|
// This library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
// GNU Lesser General Public License Usage
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// 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 GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
//##################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#include "cvfBase.h"
|
||||||
|
#include "cvfOpenGLUtils.h"
|
||||||
|
#include "cvfOpenGL.h"
|
||||||
|
#include "cvfOpenGLContext.h"
|
||||||
|
#include "cvfOpenGLCapabilities.h"
|
||||||
|
|
||||||
|
namespace cvf {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
/// \class cvf::OpenGLUtils
|
||||||
|
/// \ingroup Render
|
||||||
|
///
|
||||||
|
/// Static class providing OpenGL helpers
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Store the current OpenGL context settings by using OpenGL's built in push methods.
|
||||||
|
///
|
||||||
|
/// Note: This call MUST be matched with a corresponding popOpenGLState() call.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void OpenGLUtils::pushOpenGLState(OpenGLContext* oglContext)
|
||||||
|
{
|
||||||
|
CVF_CALLSITE_OPENGL(oglContext);
|
||||||
|
const cvf::OpenGLCapabilities* oglCaps = oglContext->capabilities();
|
||||||
|
|
||||||
|
// Only relevant for fixed function
|
||||||
|
if (!oglCaps->supportsFixedFunction())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
// For now disable pushing of the vertex array related attributes as it gives a mystical
|
||||||
|
// crash on Redhat5 under VMWare. Not a big issue, but maybe we can do without this push?
|
||||||
|
//glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
// Note: Only preserves matrix stack for texture unit 0
|
||||||
|
if (oglCaps->supportsOpenGL2())
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
}
|
||||||
|
glMatrixMode(GL_TEXTURE);
|
||||||
|
glPushMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Set back the stored OpenGL context settings by using OpenGL's built in pop methods.
|
||||||
|
///
|
||||||
|
/// Note: This call MUST be matched with a corresponding pushOpenGLState() call.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void OpenGLUtils::popOpenGLState(OpenGLContext* oglContext)
|
||||||
|
{
|
||||||
|
CVF_CALLSITE_OPENGL(oglContext);
|
||||||
|
const cvf::OpenGLCapabilities* oglCaps = oglContext->capabilities();
|
||||||
|
|
||||||
|
// Only relevant for fixed function
|
||||||
|
if (!oglCaps->supportsFixedFunction())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
// Note: Only preserves matrix stack for texture unit 0
|
||||||
|
if (oglCaps->supportsOpenGL2())
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
}
|
||||||
|
glMatrixMode(GL_TEXTURE);
|
||||||
|
glPopMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
glPopAttrib();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
|
||||||
|
// Currently not pushing vertex attribs, so comment out the pop
|
||||||
|
//glPopClientAttrib();
|
||||||
|
|
||||||
|
glPopClientAttrib();
|
||||||
|
CVF_CHECK_OGL(oglContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace cvf
|
||||||
|
|
@ -37,28 +37,22 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cvfOpenGLContext.h"
|
namespace cvf {
|
||||||
|
|
||||||
#include <QtOpenGL/QGLContext>
|
class OpenGLContext;
|
||||||
|
|
||||||
namespace cvfqt {
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
// Utility class used to piggyback OpenGLContext onto Qt's QGLContext
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class CvfBoundQGLContext : public QGLContext
|
class OpenGLUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CvfBoundQGLContext(cvf::OpenGLContextGroup* contextGroup, const QGLFormat & format);
|
static void pushOpenGLState(OpenGLContext* oglContext);
|
||||||
virtual ~CvfBoundQGLContext();
|
static void popOpenGLState(OpenGLContext* oglContext);
|
||||||
|
|
||||||
cvf::OpenGLContext* cvfOpenGLContext() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cvf::ref<cvf::OpenGLContext> m_cvfGLContext;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
#include "QMWidget.h"
|
#include "QMWidget.h"
|
||||||
|
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
using cvf::ref;
|
using cvf::ref;
|
||||||
@ -54,7 +52,7 @@ using cvf::ref;
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QMWidget::QMWidget(cvf::OpenGLContextGroup* contextGroup, QWidget* parent)
|
QMWidget::QMWidget(cvf::OpenGLContextGroup* contextGroup, QWidget* parent)
|
||||||
: cvfqt::OpenGLWidget(contextGroup, QGLFormat(), parent)
|
: cvfqt::GLWidget_deprecated(contextGroup, QGLFormat(), parent)
|
||||||
{
|
{
|
||||||
m_camera = new cvf::Camera;
|
m_camera = new cvf::Camera;
|
||||||
|
|
||||||
@ -130,14 +128,14 @@ void QMWidget::paintEvent(QPaintEvent* /*event*/)
|
|||||||
|
|
||||||
painter.beginNativePainting();
|
painter.beginNativePainting();
|
||||||
|
|
||||||
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
|
||||||
|
|
||||||
if (m_renderSequence.notNull())
|
if (m_renderSequence.notNull())
|
||||||
{
|
{
|
||||||
m_renderSequence->render(currentOglContext);
|
m_renderSequence->render(currentOglContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
|
||||||
|
|
||||||
painter.endNativePainting();
|
painter.endNativePainting();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "cvfScene.h"
|
#include "cvfScene.h"
|
||||||
#include "cvfOpenGLContextGroup.h"
|
#include "cvfOpenGLContextGroup.h"
|
||||||
|
|
||||||
#include "cvfqtOpenGLWidget.h"
|
#include "cvfqtGLWidget_deprecated.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class QMWidget : public cvfqt::OpenGLWidget
|
class QMWidget : public cvfqt::GLWidget_deprecated
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
#include "QMVWidget.h"
|
#include "QMVWidget.h"
|
||||||
|
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
using cvf::ref;
|
using cvf::ref;
|
||||||
@ -54,7 +52,7 @@ using cvf::ref;
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QMVWidget::QMVWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
|
QMVWidget::QMVWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
|
||||||
: cvfqt::OpenGLWidget(contextGroup, format, parent)
|
: cvfqt::GLWidget_deprecated(contextGroup, format, parent)
|
||||||
{
|
{
|
||||||
m_trackball = new cvf::ManipulatorTrackball;
|
m_trackball = new cvf::ManipulatorTrackball;
|
||||||
}
|
}
|
||||||
@ -64,7 +62,7 @@ QMVWidget::QMVWidget(cvf::OpenGLContextGroup* contextGroup, const QGLFormat& for
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QMVWidget::QMVWidget(QMVWidget* shareWidget, QWidget* parent)
|
QMVWidget::QMVWidget(QMVWidget* shareWidget, QWidget* parent)
|
||||||
: cvfqt::OpenGLWidget(shareWidget, parent)
|
: cvfqt::GLWidget_deprecated(shareWidget, parent)
|
||||||
{
|
{
|
||||||
m_trackball = new cvf::ManipulatorTrackball;
|
m_trackball = new cvf::ManipulatorTrackball;
|
||||||
}
|
}
|
||||||
@ -141,7 +139,7 @@ void QMVWidget::paintGL()
|
|||||||
CVF_ASSERT(currentOglContext);
|
CVF_ASSERT(currentOglContext);
|
||||||
CVF_CHECK_OGL(currentOglContext);
|
CVF_CHECK_OGL(currentOglContext);
|
||||||
|
|
||||||
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
|
||||||
|
|
||||||
if (m_renderSequence.notNull())
|
if (m_renderSequence.notNull())
|
||||||
{
|
{
|
||||||
@ -153,7 +151,7 @@ void QMVWidget::paintGL()
|
|||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfRenderSequence.h"
|
#include "cvfRenderSequence.h"
|
||||||
#include "cvfManipulatorTrackball.h"
|
#include "cvfManipulatorTrackball.h"
|
||||||
#include "cvfqtOpenGLWidget.h"
|
#include "cvfqtGLWidget_deprecated.h"
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -48,7 +48,7 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class QMVWidget : public cvfqt::OpenGLWidget
|
class QMVWidget : public cvfqt::GLWidget_deprecated
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#include "QSRTranslateEvent.h"
|
#include "QSRTranslateEvent.h"
|
||||||
|
|
||||||
#include "cvfqtPerformanceInfoHud.h"
|
#include "cvfqtPerformanceInfoHud.h"
|
||||||
#include "cvfqtOpenGLContext.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ using cvfu::TestSnippet;
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QSRSnippetWidget::QSRSnippetWidget(TestSnippet* snippet, cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
|
QSRSnippetWidget::QSRSnippetWidget(TestSnippet* snippet, cvf::OpenGLContextGroup* contextGroup, const QGLFormat& format, QWidget* parent)
|
||||||
: cvfqt::OpenGLWidget(contextGroup, format, parent),
|
: cvfqt::GLWidget_deprecated(contextGroup, format, parent),
|
||||||
m_drawHUD(false),
|
m_drawHUD(false),
|
||||||
m_lastSetRenderMode(DrawableGeo::VERTEX_ARRAY),
|
m_lastSetRenderMode(DrawableGeo::VERTEX_ARRAY),
|
||||||
m_enableMultisampleWhenDrawing(false)
|
m_enableMultisampleWhenDrawing(false)
|
||||||
@ -595,7 +594,7 @@ void QSRSnippetWidget::paintEvent(QPaintEvent* /*event*/)
|
|||||||
painter.beginNativePainting();
|
painter.beginNativePainting();
|
||||||
CVF_CHECK_OGL(currentOglContext);
|
CVF_CHECK_OGL(currentOglContext);
|
||||||
|
|
||||||
cvfqt::OpenGLContext::saveOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::pushOpenGLState(currentOglContext);
|
||||||
CVF_CHECK_OGL(currentOglContext);
|
CVF_CHECK_OGL(currentOglContext);
|
||||||
|
|
||||||
if (m_enableMultisampleWhenDrawing)
|
if (m_enableMultisampleWhenDrawing)
|
||||||
@ -612,7 +611,7 @@ void QSRSnippetWidget::paintEvent(QPaintEvent* /*event*/)
|
|||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cvfqt::OpenGLContext::restoreOpenGLState(currentOglContext);
|
cvf::OpenGLUtils::popOpenGLState(currentOglContext);
|
||||||
CVF_CHECK_OGL(currentOglContext);
|
CVF_CHECK_OGL(currentOglContext);
|
||||||
|
|
||||||
if (postEventAction == cvfu::REDRAW)
|
if (postEventAction == cvfu::REDRAW)
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#include "cvfuTestSnippet.h"
|
#include "cvfuTestSnippet.h"
|
||||||
|
|
||||||
#include "cvfqtOpenGLWidget.h"
|
#include "cvfqtGLWidget_deprecated.h"
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class QTimer;
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class QSRSnippetWidget : public cvfqt::OpenGLWidget
|
class QSRSnippetWidget : public cvfqt::GLWidget_deprecated
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user