Commit b3b8d339 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'unstable' into 'master'

sync with Unstable

See merge request !64
parents 9b30bc3b de30cd77
......@@ -65,11 +65,11 @@
#ifndef PLUGINFUNCTIONS_HH
#define PLUGINFUNCTIONS_HH
#include <OpenFlipper/common/Types.hh>
#include <QPair>
#include <QFileDialog>
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/common/OFGLWidget.hh>
#include <ACG/Scenegraph/SceneGraph.hh>
......
......@@ -54,8 +54,9 @@
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
#include <QOpenGLWidget>
#include <QSurfaceFormat>
//only forward declaration
class QOpenGLWidget;
class QSurfaceFormat;
typedef QOpenGLWidget OFGLWidget;
typedef QSurfaceFormat OFGLFormat;
......
......@@ -55,8 +55,9 @@
//=============================================================================
//== INCLUDES =================================================================
#include "GLState.hh"
#include <ACG/GL/acg_glew.hh>
#include "GLState.hh"
#include <OpenMesh/Core/Utils/vector_cast.hh>
#include <cstring>
......
......@@ -62,12 +62,10 @@
#include <cstdlib>
#include <sstream>
//with the QT_NO_OPENGL define set, Qt will hopefully not undef
//our opengl function macros. if some inclusion clash
//occurs this will cause a compile error (intended)
//if you want to use opengl calls, use separate compilation units
//for Qt and opengl stuff, or make sure this header is included last.
#define QT_NO_OPENGL
//avoid inclusion clashes. Bad inclusion order or mixing
//QtOpenGL and plain opengl functions in a single cc will cause an error
//#define QT_NO_OPENGL
//#pragma message("defined no opengl")
#if defined(ARCH_DARWIN)
......
......@@ -46,14 +46,15 @@
* $Date$ *
* *
\*===========================================================================*/
#include "globjects.hh"
#include <QImage>
#include <QGLWidget>
#include <ACG/GL/acg_glew.hh>
#include <ACG/GL/globjects.hh>
#include <ACG/GL/GLFormatInfo.hh>
#include <ACG/ShaderUtils/GLSLShader.hh>
#include <ACG/Utils/ImageConversion.hh>
#include <QImage>
#include <QGLWidget>
namespace ACG {
......@@ -640,7 +641,7 @@ bool Texture2D::loadFromFile( const std::string& _filename, GLenum _minFilter, G
if (mipmaps)
autogenerateMipMaps();
QImage gltex = QGLWidget::convertToGLFormat ( qtex );
QImage gltex = ACG::Util::convertToGLFormat(gltex);
setData(0, GL_RGBA, gltex.width(), gltex.height(), GL_RGBA, GL_UNSIGNED_BYTE, gltex.bits());
}
......
This diff is collapsed.
......@@ -61,9 +61,11 @@
//== INCLUDES =================================================================
#include "../GL/GLState.hh"
#include "../Scenegraph/SceneGraph.hh"
#include "../Scenegraph/DrawModes.hh"
#include "../Config/ACGDefines.hh"
#include "../Math/VectorT.hh"
#include "../Math/GLMatrixT.hh"
#include "../Scenegraph/PickTarget.hh"
#include <QGLFormat>
#include <QBoxLayout>
......@@ -98,12 +100,16 @@ class QImage;
class QSocketNotifier;
class QGraphicsWidget;
class QGraphicsGridLayout;
class QGLFormat;
class QGLWidget;
//== NAMESPACES ===============================================================
namespace ACG {
class GLState;
namespace SceneGraph {
class BaseNode;
}
namespace QtWidgets {
......@@ -116,7 +122,6 @@ class QtGLGraphicsView;
class QtSceneGraphDialog;
class QtShiftPopupMenu;
//== CLASS DEFINITION =========================================================
......@@ -246,11 +251,9 @@ public:
/** Set background color.
Sets the OpenGL clear color to (_c.red(), _c.green(), _c.blue(), 0).
*/
void backgroundColor(const Vec4f& _color) {
glstate_->set_clear_color(_color); updateGL();
}
void backgroundColor(const Vec4f& _color);
/// get background color
Vec4f backgroundColor() { return glstate_->clear_color(); }
Vec4f backgroundColor();
/** Lock update of display.
......@@ -764,6 +767,8 @@ private:
// helper called by drawScene() when stereo viewing is active.
void drawScene_stereo();
// helper to check openGL support
bool hasOpenGL();
// updates popup menu with the available draw modes
void updatePopupMenu();
......
......@@ -57,11 +57,14 @@
//== INCLUDES =================================================================
#include <ACG/GL/acg_glew.hh>
#include "QtBaseViewer.hh"
#include "QtGLGraphicsScene.hh"
#include "QtGLGraphicsView.hh"
#include "../GL/GLState.hh"
#include "../Scenegraph/SceneGraph.hh"
//== NAMESPACES ===============================================================
namespace ACG {
......
......@@ -58,10 +58,13 @@
//== INCLUDES =================================================================
#include <ACG/GL/acg_glew.hh>
#include "QtBaseViewer.hh"
#include <QStatusBar>
#include <QToolButton>
#include "../GL/GLState.hh"
#include "mono.xpm"
#include "stereo.xpm"
......
......@@ -57,12 +57,14 @@
//== INCLUDES =================================================================
#include <ACG/GL/acg_glew.hh>
#include "QtBaseViewer.hh"
#include "QtGLGraphicsScene.hh"
#include "QtGLGraphicsView.hh"
#include <QHostInfo>
#include "../GL/GLState.hh"
//== NAMESPACES ===============================================================
namespace ACG {
......
This diff is collapsed.
......@@ -57,7 +57,7 @@
//== INCLUDES =================================================================
#include <ACG/GL/acg_glew.hh>
#include "QtExaminerViewer.hh"
#include <QTimer>
......@@ -65,6 +65,8 @@
#include <QInputDialog>
#include <QStatusBar>
#include "../GL/GLState.hh"
#ifdef max
# undef max
#endif
......
......@@ -66,6 +66,7 @@
#include "../Math/VectorT.hh"
#include "../GL/GLState.hh"
#include "../Config/ACGDefines.hh"
#include "PickTarget.hh"
// Qt
//#include <qgl.h>
......@@ -95,30 +96,6 @@ class Material;
//== CLASS DEFINITION =========================================================
/// What target to use for picking
enum PickTarget
{
/// picks faces (may not be implemented for all nodes)
PICK_CELL,
/// picks faces (should be implemented for all nodes)
PICK_FACE,
/// picks edges (may not be implemented for all nodes)
PICK_EDGE,
/// picks verices (may not be implemented for all nodes)
PICK_VERTEX,
/// pick any of the prior targets (should be implemented for all nodes)
PICK_ANYTHING,
/// picks only visible front edges (may not be implemented for all nodes)
PICK_FRONT_EDGE,
/// picks only visible front verices (may not be implemented for all nodes)
PICK_FRONT_VERTEX,
/// Pick spline curve or surface (picks u or u,v coords respectively)
PICK_SPLINE
};
/// Convenience macro that sets up the BaseNode::className() function
#define ACG_CLASSNAME(_className) \
virtual const std::string& className() const { \
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// CLASS BaseNode
//
//=============================================================================
#pragma once
//== INCLUDES =================================================================
//== NAMESPACES ===============================================================
namespace ACG {
namespace SceneGraph {
//== CLASS DEFINITION =========================================================
/// What target to use for picking
enum PickTarget
{
/// picks faces (may not be implemented for all nodes)
PICK_CELL,
/// picks faces (should be implemented for all nodes)
PICK_FACE,
/// picks edges (may not be implemented for all nodes)
PICK_EDGE,
/// picks verices (may not be implemented for all nodes)
PICK_VERTEX,
/// pick any of the prior targets (should be implemented for all nodes)
PICK_ANYTHING,
/// picks only visible front edges (may not be implemented for all nodes)
PICK_FRONT_EDGE,
/// picks only visible front verices (may not be implemented for all nodes)
PICK_FRONT_VERTEX,
/// Pick spline curve or surface (picks u or u,v coords respectively)
PICK_SPLINE
};
}
}
......@@ -60,9 +60,11 @@
//== INCLUDES =================================================================
#include "TextNode.hh"
#include <ACG/GL/acg_glew.hh>
#include "TextNode.hh"
#include "../Utils/ImageConversion.hh"
//== NAMESPACES ===============================================================
......@@ -404,7 +406,7 @@ updateFont() {
painter.end();
// convert finalImage to an OpenGL friendly format
finalImage = QGLWidget::convertToGLFormat(finalImage);
finalImage = ACG::Util::convertToGLFormat(finalImage);
// generate a new texture from finalImage
if (!texture_)
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#include "ImageConversion.hh"
#include <QImage>
#include <QGLWidget>
QImage ACG::Util::convertToGLFormat(QImage _img)
{
return QGLWidget::convertToGLFormat ( _img );
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#pragma once
#include <ACG/Config/ACGDefines.hh>
class QImage;
namespace ACG
{
class ACGDLLEXPORT Util
{
public :
static QImage convertToGLFormat(QImage);
};
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#include "Profile.hh"
#include <QGLContext>
bool ACG::Profile::isCoreProfile()
{
return QGLContext::currentContext()->format().profile() != QGLFormat::CoreProfile;
}
bool ACG::Profile::isCompatibilityProfile()
{
return QGLContext::currentContext()->format().profile() != QGLFormat::CompatibilityProfile;
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#pragma once
#include "../Config/ACGDefines.hh"
namespace ACG
{
class ACGDLLEXPORT Profile
{
public:
static bool isCoreProfile();
static bool isCompatibilityProfile();
};
}
......@@ -59,6 +59,7 @@
//== INCLUDES =================================================================
#include <ACG/GL/acg_glew.hh>
#include "QtBaseViewer.hh"
#include "QtGLViewerLayout.hh"
......@@ -104,9 +105,6 @@
# undef min
#endif
#include <ACG/GL/acg_glew.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/ViewObjectMarker.hh>
......@@ -238,7 +236,7 @@ void glViewer::makeCurrent() {
#endif
// calling makeCurrent binds the default FBO when QOpenGLWidget is used
glWidget_->makeCurrent();
makeWidgetCurrent();
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
//restore the previously bound FBO, if it was not 0 as Qt Documentation says we shall not bind 0
......@@ -523,27 +521,6 @@ void glViewer::normalsMode(NormalsMode _mode)
//-----------------------------------------------------------------------------
void
glViewer::copyToImage( QImage& _image,
unsigned int _l, unsigned int _t,
unsigned int _w, unsigned int _h,
GLenum /* _buffer */ )
{
// makeCurrent();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 4))
_image = glWidget_->grabFramebuffer()
#else
_image = glWidget_->grabFrameBuffer(true)
#endif
.copy(_l, _t, _w, _h).convertToFormat(QImage::Format_RGB32);
}
//-----------------------------------------------------------------------------
void glViewer::updateGL()
{
if (!properties_.updateLocked() && isVisible() )
......@@ -2242,23 +2219,14 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
aspect = (double)w / (double)