Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMake/Modules/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key>
<false/>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
Expand Down
11 changes: 6 additions & 5 deletions src/Core/Renderer/RendererBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void RendererBasePrivate::redraw_scene( PickPointHandle pick_point )
this->textures_[ this->active_scene_texture_ ], false );

// swap render textures
this->active_scene_texture_ = ( ~this->active_scene_texture_ ) & 1;
this->active_scene_texture_ = this->active_scene_texture_ ^ 1;
}
}
}
Expand All @@ -120,7 +120,7 @@ void RendererBasePrivate::redraw_overlay()
this->textures_[ this->active_overlay_texture_ ], false );

// swap render textures
this->active_overlay_texture_ = ( ~( this->active_overlay_texture_ - 2 ) ) & 1 + 2;
this->active_overlay_texture_ = this->active_overlay_texture_^ 1;
}
}

Expand All @@ -144,7 +144,7 @@ void RendererBasePrivate::redraw_all()
this->textures_[ this->active_scene_texture_ ], render_overlay_success );

// swap render textures
this->active_scene_texture_ = ( ~this->active_scene_texture_ ) & 1;
this->active_scene_texture_ = this->active_scene_texture_ ^ 1;
}

if ( render_overlay_success )
Expand All @@ -154,7 +154,7 @@ void RendererBasePrivate::redraw_all()
this->textures_[ this->active_overlay_texture_ ], false );

// swap render textures
this->active_overlay_texture_ = ( ~( this->active_overlay_texture_ - 2 ) ) & 1 + 2;
this->active_overlay_texture_ = this->active_overlay_texture_^ 1;
}
}

Expand Down Expand Up @@ -417,7 +417,7 @@ void RendererBase::redraw_all()
this->private_->redraw_all();
}

void RendererBase::resize( int width, int height )
void RendererBase::resize(int width, int height)
{
if ( !this->is_renderer_thread() )
{
Expand Down Expand Up @@ -447,6 +447,7 @@ void RendererBase::resize( int width, int height )
this->private_->scene_depth_buffer_->set_storage( width, height, GL_DEPTH_COMPONENT24 );
this->private_->overlay_depth_buffer_->set_storage( width, height, GL_DEPTH_COMPONENT24 );
}
std::cout << width << ", " << height << "\n";

this->width_ = width;
this->height_ = height;
Expand Down
32 changes: 16 additions & 16 deletions src/QtUtils/Utils/QtRenderResources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ typedef boost::shared_ptr< QtRenderContext > QtRenderContextHandle;
// Shared pointer to one of Qt's internal resources
// NOTE: As GLContext objects are not managed by Qt we
// need to do this ourselves using a smart pointer
typedef boost::shared_ptr< QGLContext > QGLContextHandle;
typedef boost::shared_ptr< QOpenGLContext > QOpenGLContextHandle;

class QtRenderContext : public Core::RenderContext
{
// -- constructor/ destructor --
public:
QtRenderContext( QGLContextHandle context );
QtRenderContext( QOpenGLContextHandle context );
virtual ~QtRenderContext();

// -- context functions --
Expand All @@ -74,21 +74,21 @@ class QtRenderContext : public Core::RenderContext
virtual void swap_buffers() const;

private:
QGLContextHandle context_;
QOpenGLContextHandle context_;
};

class QtRenderResourcesContextPrivate
{
public:
// The Qt render context format options
QGLFormat format_;
QSurfaceFormat format_;

// The handle to the first qt widget that defines all the sharing
// between contexts
QGLWidget* shared_widget_;
QOpenGLWidget* shared_widget_;
};

QtRenderContext::QtRenderContext( QGLContextHandle context ) :
QtRenderContext::QtRenderContext( QOpenGLContextHandle context ) :
context_( context )
{
}
Expand Down Expand Up @@ -124,8 +124,8 @@ void QtRenderContext::swap_buffers() const
QtRenderResourcesContext::QtRenderResourcesContext() :
private_( new QtRenderResourcesContextPrivate )
{
this->private_->format_ = QGLFormat::defaultFormat();
this->private_->shared_widget_ = new QGLWidget( this->private_->format_ );
this->private_->format_ = QSurfaceFormat::defaultFormat();
this->private_->shared_widget_ = new QOpenGLWidget( this->private_->format_ );
}

QtRenderResourcesContext::~QtRenderResourcesContext()
Expand All @@ -136,7 +136,7 @@ QtRenderResourcesContext::~QtRenderResourcesContext()
bool QtRenderResourcesContext::create_render_context( Core::RenderContextHandle& context )
{
// Generate a new context
QGLContextHandle qt_context = QGLContextHandle( new QGLContext( this->private_->format_,
QOpenGLContextHandle qt_context = QOpenGLContextHandle( new QOpenGLContext( this->private_->format_,
this->private_->shared_widget_->context()->device() ) );
qt_context->create( this->private_->shared_widget_->context() );

Expand All @@ -146,16 +146,16 @@ bool QtRenderResourcesContext::create_render_context( Core::RenderContextHandle&
return context->is_valid();
}

QtRenderWidget* QtRenderResourcesContext::create_qt_render_widget( QWidget* parent,
QtRenderWidget* QtRenderResourcesContext::create_qt_render_widget( QWidget* parent,
Core::AbstractViewerHandle viewer )
{
CORE_LOG_DEBUG( "Create an OpenGL widget" );

return new QtRenderWidget( this->private_->format_, parent,
return new QtRenderWidget( this->private_->format_, parent,
this->private_->shared_widget_, viewer );
}

QtTransferFunctionWidget* QtRenderResourcesContext::create_qt_transfer_function_widget(
QtTransferFunctionWidget* QtRenderResourcesContext::create_qt_transfer_function_widget(
QWidget* parent, Core::TransferFunctionHandle tf )
{
return new QtTransferFunctionWidget( this->private_->format_, parent,
Expand All @@ -178,15 +178,15 @@ class SharedPtrNopDeleter

Core::RenderContextHandle QtRenderResourcesContext::get_current_context()
{
const QGLContext* current_context = QGLContext::currentContext();
const QOpenGLContext* current_context = QOpenGLContext::currentContext();
if ( current_context != 0 )
{
// NOTE: We don't want to delete the context after the handle goes out of scope,
// so we pass a NOP deleter to shared_ptr
return Core::RenderContextHandle( new QtRenderContext( QGLContextHandle(
const_cast< QGLContext* >( current_context ), SharedPtrNopDeleter() ) ) );
return Core::RenderContextHandle( new QtRenderContext( QOpenGLContextHandle(
const_cast< QOpenGLContext* >( current_context ), SharedPtrNopDeleter() ) ) );
}

return Core::RenderContextHandle();
}

Expand Down
6 changes: 3 additions & 3 deletions src/QtUtils/Utils/QtRenderResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#endif

// Glew include
#include <GL/glew.h>
Expand Down Expand Up @@ -60,9 +60,9 @@ namespace QtUtils
// Forward declarations
class QtRenderResourcesContext;
class QtRenderResourcesContextPrivate;
typedef boost::shared_ptr< QtRenderResourcesContext >
typedef boost::shared_ptr< QtRenderResourcesContext >
QtRenderResourcesContextHandle;
typedef boost::shared_ptr< QtRenderResourcesContextPrivate >
typedef boost::shared_ptr< QtRenderResourcesContextPrivate >
QtRenderResourcesContextPrivateHandle;

// Class definition
Expand Down
10 changes: 5 additions & 5 deletions src/QtUtils/Utils/QtRenderWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void QtRenderWidgetPrivate::exit_size_move()
// Class QtRenderWidget
//////////////////////////////////////////////////////////////////////////

QtRenderWidget::QtRenderWidget( const QGLFormat& format, QWidget* parent,
QGLWidget* share, Core::AbstractViewerHandle viewer ) :
QGLWidget( format, parent, share ),
QtRenderWidget::QtRenderWidget( const QSurfaceFormat& format, QWidget* parent,
QOpenGLWidget* share, Core::AbstractViewerHandle viewer ) :
QOpenGLWidget( parent, share ),
private_( new QtRenderWidgetPrivate )
{
this->private_->viewer_ = viewer;
Expand Down Expand Up @@ -165,8 +165,8 @@ void QtRenderWidget::paintGL()

// draw a window size quad and map the render texture onto it
QSize view_size = QWidget::size();
int width = view_size.width();
int height = view_size.height();
int width = 2 * view_size.width();
int height = 2 * view_size.height();

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
Expand Down
45 changes: 23 additions & 22 deletions src/QtUtils/Utils/QtRenderWidget.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
For more information, please see: http://software.sci.utah.edu

The MIT License

Copyright (c) 2016 Scientific Computing and Imaging Institute,
University of Utah.


Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Expand All @@ -31,7 +31,7 @@

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#endif

#ifndef Q_MOC_RUN

Expand All @@ -41,12 +41,13 @@
// Qt includes
#undef __GLEW_H__
#include <QtOpenGL>
#include <QOpenGLWidget>
#define __GLEW_H__


// Core includes
#include <Core/Utils/ConnectionHandler.h>
#include <Core/RenderResources/RenderResources.h>
#include <Core/RenderResources/RenderResources.h>
#include <Core/Viewer/AbstractViewer.h>

#endif
Expand All @@ -58,15 +59,15 @@ class QtRenderWidget;
class QtRenderWidgetPrivate;
typedef boost::shared_ptr<QtRenderWidgetPrivate> QtRenderWidgetPrivateHandle;

class QtRenderWidget : public QGLWidget, private Core::ConnectionHandler
class QtRenderWidget : public QOpenGLWidget, private Core::ConnectionHandler
{
Q_OBJECT

// -- constructor/ destructor --
public:
QtRenderWidget( const QGLFormat& format, QWidget* parent, QGLWidget* share,
QtRenderWidget( const QSurfaceFormat& format, QWidget* parent, QOpenGLWidget* share,
Core::AbstractViewerHandle viewer );

virtual ~QtRenderWidget();

void saveSceneOnly(const std::string& name);
Expand All @@ -78,12 +79,12 @@ Q_OBJECT
/// INITIALIZEGL:
/// This function is called by Qt when the widget is initialized
virtual void initializeGL();

/// PAINTGL:
/// This function is called whenever Qt has to repaint the contents of
/// This function is called whenever Qt has to repaint the contents of
/// the widget displaying the Qt scene
virtual void paintGL();

/// RESIZEGL:
/// This function gets called whenever the Qt widget is resized
virtual void resizeGL( int width, int height );
Expand All @@ -95,22 +96,22 @@ Q_OBJECT

/// MOUSEMOVEEVENT:
/// This function is called by Qt to deliver mouse movement event
/// to the GUI.
/// to the GUI.
virtual void mouseMoveEvent( QMouseEvent * event );

/// MOUSEDOUBLECLICKEVENT:
/// This function is called by Qt to deliver a single mouse click event
/// to the GUI.
virtual void mousePressEvent( QMouseEvent * event );

/// MOUSERELEASEEVENT:
/// This function is called by Qt to deliver a mouse button release event
/// to the GUI.
/// to the GUI.
virtual void mouseReleaseEvent( QMouseEvent * event );

/// WHEELEVENT:
/// This function is called by Qt to deliver mouse wheel event
/// to the GUI.
/// to the GUI.
virtual void wheelEvent( QWheelEvent* event );

/// ENTEREVENT:
Expand All @@ -120,7 +121,7 @@ Q_OBJECT
/// LEAVEEVENT:
/// This function is called by Qt when the mouse finishes to hover over the widget
virtual void leaveEvent( QEvent* event );

/// KEYPRESSEVENT:
/// This function is called by Qt when a key is pressed
virtual void keyPressEvent( QKeyEvent* event );
Expand All @@ -136,7 +137,7 @@ Q_OBJECT
// -- internals of the QtRenderWidget --
private:
QtRenderWidgetPrivateHandle private_;

// -- signals / slots --
public:
/// ACTIVATE_SIGNAL:
Expand Down
6 changes: 3 additions & 3 deletions src/QtUtils/Utils/QtTransferFunctionWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class QtTransferFunctionWidgetPrivate

typedef QPointer< QtTransferFunctionWidget > QtTransferFunctionWidgetWeakHandle;

QtTransferFunctionWidget::QtTransferFunctionWidget( const QGLFormat& format, QWidget* parent,
QGLWidget* share, Core::TransferFunctionHandle tf ) :
QGLWidget( format, parent, share ),
QtTransferFunctionWidget::QtTransferFunctionWidget( const QSurfaceFormat& format, QWidget* parent,
QOpenGLWidget* share, Core::TransferFunctionHandle tf ) :
QOpenGLWidget( parent, share ),
private_( new QtTransferFunctionWidgetPrivate )
{
this->private_->transfer_function_ = tf;
Expand Down
Loading