Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Revert "Use QOpenGLWidget instead of QGLWidget" (#350)

Keisuke Ogaki0c8292e173b0
diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h
index 98d814695..ed6b80444 100644
--- a/toonz/sources/include/toonzqt/styleeditor.h
+++ b/toonz/sources/include/toonzqt/styleeditor.h
@@ -32,8 +32,7 @@
#include <QSlider>
#include <QToolButton>
#include <QScrollArea>
-#include <QOpenGLWidget>
-#include <QOpenGLFunctions_3_0>
+#include <QGLWidget>
#include <QMouseEvent>
#include <QPointF>
@@ -142,7 +141,7 @@ enum CurrentWheel {
rightTriangle
};
-class DVAPI HexagonalColorWheel : public QOpenGLWidget, private QOpenGLFunctions_3_0
+class DVAPI HexagonalColorWheel : public QGLWidget
{
Q_OBJECT
@@ -176,17 +175,17 @@ public:
QColor getBGColor() const { return m_bgColor; }
protected:
- void initializeGL() override;
- void resizeGL(int width, int height) override;
- void paintGL() override;
+ void initializeGL();
+ void resizeGL(int width, int height);
+ void paintGL();
QSize SizeHint() const
{
return QSize(300, 200);
};
- void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
signals:
void colorChanged(const ColorModel &color, bool isDragging);
diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt
index 0a759d687..df8a6775f 100644
--- a/toonz/sources/toonz/CMakeLists.txt
+++ b/toonz/sources/toonz/CMakeLists.txt
@@ -143,7 +143,9 @@ set(MOC_HEADERS
metnum.h
ObjectTracker.h
predict3d.h
- processor.h)
+ processor.h
+ viewer.h
+ writer.h)
set(HEADERS ${MOC_HEADERS})
@@ -298,7 +300,9 @@ set(SOURCES
dummyprocessor.cpp
metnum.cpp
ObjectTracker.cpp
- predict3d.cpp)
+ predict3d.cpp
+ viewer.cpp
+ writer.cpp)
add_translation(toonz ${HEADERS} ${SOURCES})
diff --git a/toonz/sources/toonz/flipbook.cpp b/toonz/sources/toonz/flipbook.cpp
index 0c7eaf85d..1e25c7b04 100644
--- a/toonz/sources/toonz/flipbook.cpp
+++ b/toonz/sources/toonz/flipbook.cpp
@@ -1894,7 +1894,7 @@ void FlipBook::showEvent(QShowEvent *e)
m_flipConsole->onPreferenceChanged();
}
m_flipConsole->setActive(true);
- m_imageViewer->update();
+ m_imageViewer->updateGL();
}
//-------------------------------------------------------------------
diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp
index b32885dda..68220dedb 100644
--- a/toonz/sources/toonz/imageviewer.cpp
+++ b/toonz/sources/toonz/imageviewer.cpp
@@ -205,22 +205,10 @@ public:
*/
ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram)
- : QOpenGLWidget(parent)
- , m_pressedMousePos(0, 0)
- , m_mouseButton(Qt::NoButton)
- , m_draggingZoomSelection(false)
- , m_image()
- , m_FPS(0)
- , m_viewAff()
- , m_pos(0, 0)
- , m_visualSettings()
- , m_compareSettings()
- , m_isHistogramEnable(showHistogram)
- , m_flipbook(flipbook)
- , m_isColorModel(false)
- , m_histogramPopup(0)
- , m_isRemakingPreviewFx(false)
- , m_rectRGBPick(false)
+ : QGLWidget(parent), m_pressedMousePos(0, 0), m_mouseButton(Qt::NoButton), m_draggingZoomSelection(false), m_image(), m_FPS(0), m_viewAff(), m_pos(0, 0), m_visualSettings(), m_compareSettings(), m_isHistogramEnable(showHistogram), m_flipbook(flipbook), m_isColorModel(false), m_histogramPopup(0), m_isRemakingPreviewFx(false)
+ //, m_ghibli3DLutUtil(0) //iwsw commented out temporarily
+ ,
+ m_rectRGBPick(false)
{
m_visualSettings.m_sceneProperties = TApp::instance()->getCurrentScene()->getScene()->getProperties();
m_visualSettings.m_drawExternalBG = true;
@@ -231,6 +219,10 @@ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram
if (m_isHistogramEnable)
m_histogramPopup = new HistogramPopup(tr("Flipbook Histogram"));
+
+ //iwsw commented out 2 lines temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && Ghibli3DLutUtil::m_isValid)
+ // m_ghibli3DLutUtil = new Ghibli3DLutUtil();
}
//-----------------------------------------------------------------------------
@@ -247,7 +239,7 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event)
return;
}
- std::unique_ptr<QMenu> menu(new QMenu(this));
+ QMenu *menu = new QMenu(this);
if (m_flipbook->getPreviewedFx()) {
if (!(windowState() & Qt::WindowFullScreen)) {
@@ -334,7 +326,8 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event)
action = CommandManager::instance()->getAction(MI_LoadRecentImage);
action->setParent(0);
- update();
+ delete menu;
+ updateGL();
}
//-----------------------------------------------------------------------------
@@ -346,6 +339,20 @@ void ImageViewer::setVisual(const ImagePainter::VisualSettings &settings)
m_visualSettings.m_drawExternalBG = true;
}
+//-----------------------------------------------------------------------------
+
+ImageViewer::~ImageViewer()
+{
+ //iwsw commented out temporarily
+ /*
+ if (m_ghibli3DLutUtil)
+ {
+ m_ghibli3DLutUtil->onEnd();
+ delete m_ghibli3DLutUtil;
+ }
+ */
+}
+
//-----------------------------------------------------------------------------
/*! Set current image to \b image and update. If Histogram is visible set its image.
*/
@@ -396,8 +403,12 @@ void ImageViewer::hideHistogram()
void ImageViewer::initializeGL()
{
- initializeOpenGLFunctions();
+ // glClearColor(1.0,1.0,1.0,1);
glClear(GL_COLOR_BUFFER_BIT);
+
+ //iwsw commented out temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ // m_ghibli3DLutUtil->onInit();
}
//-----------------------------------------------------------------------------
@@ -415,15 +426,26 @@ void ImageViewer::resizeGL(int w, int h)
glLoadIdentity();
glTranslatef(0.375, 0.375, 0.0);
glTranslated(w * 0.5, h * 0.5, 0);
+
+ //iwsw commented out temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ // m_ghibli3DLutUtil->onResize(w, h);
}
//-----------------------------------------------------------------------------
void ImageViewer::paintGL()
{
+ //iwsw commented out temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ // m_ghibli3DLutUtil->startDraw();
+
TDimension viewerSize(width(), height());
TAffine aff = m_viewAff;
+ //if (!m_visualSettings.m_defineLoadbox && m_flipbook && m_flipbook->getLoadbox()!=TRect())
+ // offs = convert(m_flipbook->getLoadbox().getP00())-TPointD(m_flipbook->getImageSize().lx/2.0, m_flipbook->getImageSize().ly/2.0);
+
TDimension imageSize;
TRect loadbox;
@@ -436,7 +458,6 @@ void ImageViewer::paintGL()
loadbox = m_flipbook->getLoadbox();
}
m_visualSettings.m_sceneProperties = TApp::instance()->getCurrentScene()->getScene()->getProperties();
-
// enable checks only in the color model
m_visualSettings.m_useChecks = m_isColorModel;
ImagePainter::paintImage(m_image, imageSize, viewerSize, aff, m_visualSettings, m_compareSettings, loadbox);
@@ -465,6 +486,10 @@ void ImageViewer::paintGL()
}
if (!m_image) {
+ //iwsw commented out temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ // m_ghibli3DLutUtil->endDraw();
+
return;
}
@@ -533,6 +558,10 @@ void ImageViewer::paintGL()
glEnd();
}
}
+
+ //iwsw commented out temporarily
+ //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ // m_ghibli3DLutUtil->endDraw();
}
//------------------------------------------------------------------------------
@@ -790,8 +819,16 @@ void ImageViewer::pickColor(QMouseEvent *event, bool putValueToStyleEditor)
TPoint mousePos = TPoint(event->pos().x(), height() - 1 - event->pos().y());
TRectD area = TRectD(mousePos.x, mousePos.y, mousePos.x, mousePos.y);
+ //iwsw commented out temporarily
+ //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
+ // get3DLutUtil()->bindFBO();
+
const TPixel32 pix = picker.pickColor(area);
+ //iwsw commented out temporarily
+ //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
+ // get3DLutUtil()->releaseFBO();
+
QPoint viewP = mapFrom(this, event->pos());
TPointD pos = getViewAff().inv() * TPointD(viewP.x() - width() / 2,
-viewP.y() + height() / 2);
@@ -830,8 +867,16 @@ void ImageViewer::rectPickColor(bool putValueToStyleEditor)
return;
}
+ //iwsw commented out temporarily
+ //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
+ // get3DLutUtil()->bindFBO();
+
const TPixel32 pix = picker.pickColor(area.enlarge(-1, -1));
+ //iwsw commented out temporarily
+ //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
+ // get3DLutUtil()->releaseFBO();
+
//throw the picked color to the histogram
m_histogramPopup->updateAverageColor(pix);
//throw it to the style editor as well
@@ -1083,14 +1128,6 @@ void ImageViewer::adaptView(const QRect &geomRect)
adaptView(imgBounds, viewRect);
}
-void ImageViewer::doSwapBuffers() {
- update();
-}
-
-void ImageViewer::changeSwapBehavior(bool enable) {
- setUpdateBehavior(enable ? PartialUpdate : NoPartialUpdate);
-}
-
//-----------------------------------------------------------------------------
void ImageViewer::keyPressEvent(QKeyEvent *event)
diff --git a/toonz/sources/toonz/imageviewer.h b/toonz/sources/toonz/imageviewer.h
index 655ceb700..f3c9b4f68 100644
--- a/toonz/sources/toonz/imageviewer.h
+++ b/toonz/sources/toonz/imageviewer.h
@@ -3,10 +3,12 @@
#ifndef IMAGEVIEWER_INCLUDE
#define IMAGEVIEWER_INCLUDE
+//iwsw commented out temporarily
+//#include "toonzqt/ghibli_3dlut_util.h"
+
#include "toonz/imagepainter.h"
-#include <QOpenGLWidget>
-#include <QOpenGLFunctions_3_0>
+#include <QGLWidget>
//-----------------------------------------------------------------------------
@@ -20,7 +22,7 @@ class HistogramPopup;
// ImageViewer
//--------------------
-class ImageViewer : public QOpenGLWidget, private QOpenGLFunctions_3_0
+class ImageViewer : public QGLWidget
{
Q_OBJECT
enum DragType { eNone,
@@ -56,6 +58,9 @@ class ImageViewer : public QOpenGLWidget, private QOpenGLFunctions_3_0
//a flipbook shows a red border line before the rendered result is shown.
bool m_isRemakingPreviewFx;
+ //iwsw commented out temporarily
+ //Ghibli3DLutUtil * m_ghibli3DLutUtil;
+
int getDragType(const TPoint &pos, const TRect &loadBox);
void updateLoadbox(const TPoint &curPos);
void updateCursor(const TPoint &curPos);
@@ -67,6 +72,7 @@ class ImageViewer : public QOpenGLWidget, private QOpenGLFunctions_3_0
public:
ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram);
+ ~ImageViewer();
void setIsColorModel(bool isColorModel) { m_isColorModel = isColorModel; }
bool isColorModel() { return m_isColorModel; }
@@ -100,21 +106,28 @@ public:
void adaptView(const TRect &imgRect, const TRect &viewRect);
void adaptView(const QRect &viewerRect);
- void doSwapBuffers();
- void changeSwapBehavior(bool enable);
+ void doSwapBuffers()
+ {
+ swapBuffers();
+ glFlush();
+ }
+ void changeSwapBehavior(bool enable) { setAutoBufferSwap(enable); }
+
+ //iwsw commented out temporarily
+ //Ghibli3DLutUtil* get3DLutUtil(){ return m_ghibli3DLutUtil; }
protected:
- void contextMenuEvent(QContextMenuEvent *event) override;
- void initializeGL() override;
- void resizeGL(int width, int height) override;
- void paintGL() override;
-
- void mouseMoveEvent(QMouseEvent *event) override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void keyPressEvent(QKeyEvent *event) override;
- void mouseDoubleClickEvent(QMouseEvent *event) override;
- void wheelEvent(QWheelEvent *) override;
+ void contextMenuEvent(QContextMenuEvent *event);
+ void initializeGL();
+ void resizeGL(int width, int height);
+ void paintGL();
+
+ void mouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void keyPressEvent(QKeyEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *event);
+ void wheelEvent(QWheelEvent *);
void panQt(const QPoint &delta);
void zoomQt(const QPoint &center, double factor);
diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp
index 342ce4223..1e93d966b 100644
--- a/toonz/sources/toonz/main.cpp
+++ b/toonz/sources/toonz/main.cpp
@@ -258,11 +258,6 @@ int main(int argc, char *argv[])
}
}
- QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-#endif
-
QApplication a(argc, argv);
#ifdef Q_OS_WIN
diff --git a/toonz/sources/toonz/viewer.cpp b/toonz/sources/toonz/viewer.cpp
new file mode 100644
index 000000000..5da5b9a7e
--- /dev/null
+++ b/toonz/sources/toonz/viewer.cpp
@@ -0,0 +1,83 @@
+
+
+#include <QPainter>
+#include "tgl.h"
+#include "viewer.h"
+#include "processor.h"
+
+//=============================================================================
+// Viewer
+//-----------------------------------------------------------------------------
+
+Viewer::Viewer(QWidget *parent)
+ : QGLWidget(parent), m_raster(0), m_processor(0), update_frame(true)
+{
+}
+
+//-----------------------------------------------------------------------------
+
+Viewer::~Viewer()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+void Viewer::initializeGL()
+{
+ glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+}
+
+//-----------------------------------------------------------------------------
+
+void Viewer::resizeGL(int width, int height)
+{
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, width, 0, height, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ // To maintain pixel accuracy
+ glTranslated(0.375, 0.375, 0.0);
+}
+
+//-----------------------------------------------------------------------------
+
+void Viewer::paintGL()
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+ if (m_raster) {
+ glRasterPos2d(0, 0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap());
+ glDrawPixels(m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData());
+ }
+ if (m_processor) {
+ m_processor->draw();
+ }
+
+ if (m_message != "") {
+ glColor3d(0, 0, 0);
+ glPushMatrix();
+ const double sc = 5;
+ glScaled(sc, sc, sc);
+ tglDrawText(TPointD(5, 5), m_message);
+ glPopMatrix();
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void Viewer::setRaster(TRaster32P raster)
+{
+ m_raster = raster;
+ if (update_frame)
+ update();
+}
+
+//-----------------------------------------------------------------------------
+
+void Viewer::setMessage(std::string msg)
+{
+ m_message = msg;
+ update();
+}
diff --git a/toonz/sources/toonz/viewer.h b/toonz/sources/toonz/viewer.h
new file mode 100644
index 000000000..a035b285d
--- /dev/null
+++ b/toonz/sources/toonz/viewer.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#ifndef VIEWER_H
+#define VIEWER_H
+
+#include <QGLWidget>
+#include "traster.h"
+
+class Processor;
+
+//! OpenGL Widget that display the movie
+class Viewer : public QGLWidget
+{
+ //! Raster that store the current Frame of the Movie.
+ TRaster32P m_raster;
+ Q_OBJECT;
+ //! String used to display "loading" text while the movie is being loaded
+ std::string m_message;
+ //! Pointer to a Processor to process the frame drawing OpenGL primitive over it.
+ Processor *m_processor;
+
+public:
+ bool update_frame;
+
+ //! Construct a QGLWidget object which is a child of parent.
+ Viewer(QWidget *parent = 0);
+ //! Destroys the widget
+ ~Viewer();
+
+ //! Set the raster to draw
+ void setRaster(TRaster32P raster);
+ //! Returns the raster
+ const TRaster32P &getRaster() const { return m_raster; }
+
+ //! Set the Processor to draw over the current frame
+ void setProcessor(Processor *processor) { m_processor = processor; }
+ //! Set the message. This message is displayed for every frame (if is a non-empty string).
+ void setMessage(std::string msg);
+
+protected:
+ void initializeGL();
+ void paintGL();
+ void resizeGL(int width, int height);
+};
+
+#endif // VIEWER_H
diff --git a/toonz/sources/toonz/writer.cpp b/toonz/sources/toonz/writer.cpp
new file mode 100644
index 000000000..c5c982984
--- /dev/null
+++ b/toonz/sources/toonz/writer.cpp
@@ -0,0 +1,60 @@
+
+
+#include <QPainter>
+#include "tgl.h"
+#include "writer.h"
+#include "processor.h"
+#include "trasterimage.h"
+
+//=============================================================================
+// Writer
+//----------------------------------------------------------------------------
+
+Writer::Writer(const TFilePath &outputFile, int lx, int ly)
+ : m_pixmap(lx, ly), m_context(0), m_levelWriter(outputFile), m_frameCount(0), m_raster(lx, ly)
+{
+ QGLFormat glFormat;
+ m_context = new QGLContext(glFormat, &m_pixmap);
+ m_context->makeCurrent();
+
+ glViewport(0, 0, lx, ly);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, lx, 0, ly, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ // To maintain pixel accuracy
+ glTranslated(0.375, 0.375, 0.0);
+ glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+}
+
+//-----------------------------------------------------------------------------
+
+Writer::~Writer()
+{
+ delete m_context;
+}
+
+//-----------------------------------------------------------------------------
+
+void Writer::write(const TRaster32P &ras, Processor *processor)
+{
+ m_context->makeCurrent();
+ glClear(GL_COLOR_BUFFER_BIT);
+ if (ras) {
+ glRasterPos2d(0, 0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap());
+ glDrawPixels(ras->getLx(), ras->getLy(), TGL_FMT, TGL_TYPE, ras->getRawData());
+ }
+ if (processor) {
+ processor->draw();
+ }
+ glRasterPos2d(0, 0);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap());
+ glReadPixels(0, 0, m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData());
+
+ TImageP img = TRasterImageP(m_raster);
+ m_levelWriter->getFrameWriter(++m_frameCount)->save(img);
+}
+
+//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/writer.h b/toonz/sources/toonz/writer.h
new file mode 100644
index 000000000..4e388e4dc
--- /dev/null
+++ b/toonz/sources/toonz/writer.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#ifndef WRITER_H
+#define WRITER_H
+
+#include <QGLWidget>
+#include "traster.h"
+#include "tfilepath.h"
+#include "tlevel_io.h"
+
+class Processor;
+
+//! Draw the frame (with the processing) before saving it.
+class Writer
+{
+ //! QPaintDevice used only to initialize the QGLContext
+ QPixmap m_pixmap;
+ //! Offline OpenGL context that draw directly to a QPaintDevice (in this case a QPixmap)
+ QGLContext *m_context;
+ //! Class to write the level to file
+ TLevelWriterP m_levelWriter;
+ //! Frame counter
+ int m_frameCount;
+ //! Current Raster
+ TRaster32P m_raster;
+
+public:
+ //! Constructor
+ /*!
+ \param &outputFile filename of the output movie
+ \param lx an integer contains the width of the movie
+ \param ly an integer contains the height of the movie
+ */
+ Writer(const TFilePath &outputFile, int lx, int ly);
+ //! Destructor
+ ~Writer();
+
+ /*! Write the raster, using the processor to the GL Context,
+ then read the context to store it in the m_raster.
+ Hence write m_raster to the movie file using TLevelWriter
+ */
+ void write(const TRaster32P &ras, Processor *processor);
+
+protected:
+};
+
+#endif // WRITER_H
diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp
index 349cf3dd7..78eb93326 100644
--- a/toonz/sources/toonzqt/styleeditor.cpp
+++ b/toonz/sources/toonzqt/styleeditor.cpp
@@ -587,29 +587,49 @@ QPixmap makeSquareShading(
//*****************************************************************************
HexagonalColorWheel::HexagonalColorWheel(QWidget *parent)
- : QOpenGLWidget(parent)
- , m_bgColor(128, 128, 128) //defaul value in case this value does not set in the style sheet
+ : QGLWidget(parent), m_bgColor(128, 128, 128) //defaul value in case this value does not set in the style sheet
+ //, m_ghibli3DLutUtil(0)//iwsw commented out temporarily
{
setObjectName("HexagonalColorWheel");
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setFocusPolicy(Qt::NoFocus);
m_currentWheel = none;
+
+ //iwsw commented out temporarily
+ /*
+ if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && Ghibli3DLutUtil::m_isValid)
+ {
+ m_ghibli3DLutUtil = new Ghibli3DLutUtil();
+ m_ghibli3DLutUtil->setInvert();
+ }
+ */
}
//-----------------------------------------------------------------------------
HexagonalColorWheel::~HexagonalColorWheel()
{
+ //iwsw commented out temporarily
+ /*
+ if(m_ghibli3DLutUtil)
+ {
+ m_ghibli3DLutUtil->onEnd();
+ delete m_ghibli3DLutUtil;
+ }
+ */
}
//-----------------------------------------------------------------------------
void HexagonalColorWheel::initializeGL()
{
- initializeOpenGLFunctions();
+ qglClearColor(getBGColor());
- QColor color = getBGColor();
- glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
+ //iwsw commented out temporarily
+ /*
+ if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ m_ghibli3DLutUtil->onInit();
+ */
}
//-----------------------------------------------------------------------------
@@ -659,17 +679,29 @@ void HexagonalColorWheel::resizeGL(int width, int height)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, (GLdouble)width, (GLdouble)height, 0.0, 1.0, -1.0);
+
+ //iwsw commented out temporarily
+ /*
+ if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ m_ghibli3DLutUtil->onResize(width,height);
+ */
}
//-----------------------------------------------------------------------------
void HexagonalColorWheel::paintGL()
{
- QColor color = getBGColor();
- glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
+ //call ClearColor() here in order to update bg color when the stylesheet is switched
+ qglClearColor(getBGColor());
glMatrixMode(GL_MODELVIEW);
+ //iwsw commented out temporarily
+ /*
+ if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ m_ghibli3DLutUtil->startDraw();
+ */
+
glClear(GL_COLOR_BUFFER_BIT);
float v = (float)m_color.getValue(eValue) / 100.0f;
@@ -714,6 +746,12 @@ void HexagonalColorWheel::paintGL()
drawCurrentColorMark();
glPopMatrix();
+
+ //iwsw commented out temporarily
+ /*
+ if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil)
+ m_ghibli3DLutUtil->endDraw();
+ */
}
//-----------------------------------------------------------------------------