Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

Commit 89507955 authored by WINTZ Julien's avatar WINTZ Julien

First experiment failed but brought many intersting fixes and features.

KEEP BRANCH AS LONG AS NEEDED.
parent f4e1e747
......@@ -91,9 +91,9 @@ find_package(dtkFonts 2.0.0 REQUIRED)
find_package(dtkWidgets 2.1.0 REQUIRED)
find_package(dtkLog 2.1.0 REQUIRED)
if(WIN32)
# if(WIN32)
find_package(OpenGL REQUIRED)
endif(WIN32)
# endif(WIN32)
include(${VTK_USE_FILE})
......
......@@ -14,7 +14,7 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/examples)
add_subdirectory(dtkVisualizationGL)
add_subdirectory(dtkVisualizationDecoratorGL)
add_subdirectory(dtkVisualizationOverlayPaneItem)
add_subdirectory(dtkVisualizationOverlayRope)
add_subdirectory(dtkVisualizationPlot2D)
......
......@@ -12,7 +12,7 @@
##
### Code:
project(dtkVisualizationGL)
project(dtkVisualizationDecoratorGL)
## #################################################################
## Sources
......@@ -34,10 +34,6 @@ target_link_libraries(${PROJECT_NAME} dtkVisualization)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
endif(WIN32)
## ###################################################################
## Bundle setup
## ###################################################################
......
......@@ -17,6 +17,7 @@
#include <vtkInformation.h>
#include <vtkMapper.h>
#include <vtkObjectFactory.h>
#include <vtkOpenGLActor.h>
// #include <vtkOpenGLRenderer.h>
// #include <vtkOpenGLRenderWindow.h>
// #include <vtkOpenGLResourceFreeCallback.h>
......@@ -210,23 +211,21 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
if (renderer->GetRenderWindow()->CheckAbortStatus())
return;
qDebug() << Q_FUNC_INFO << renderer;
// d->handler->RegisterGraphicsResources(static_cast<vtkOpenGLRenderWindow *>(renderer->GetRenderWindow()));
// this->InvokeEvent(vtkCommand::StartEvent, nullptr);
// this->InvokeEvent(vtkCommand::EndEvent, nullptr);
// qDebug() << "BEFORE FIRST MAKE CURRENT" << this->view->context();
// qDebug() << "BEFORE FIRST MAKE CURRENT" << this->view->context()->format();
this->view->makeCurrent();
qDebug() << Q_FUNC_INFO << "isValid" << this->view->isValid();
qDebug() << Q_FUNC_INFO << "isCurrent" << this->view->isCurrent();
// Q_ASSERT(this->view->isValid());
// Q_ASSERT(this->view->isCurrent());
qDebug() << "VIEW CONTEXT" << this->view->context();
qDebug() << "VIEW FORMAT" << this->view->context()->format();
qDebug() << "GLOBAL CONTEXT" << QOpenGLContext::currentContext();
qDebug() << "GLOBAL FORMAT" << QOpenGLContext::currentContext()->format();
// qDebug() << "AFTER FIRST MAKE CURRENT" << this->view->context();
// qDebug() << "AFTER FIRST MAKE CURRENT" << this->view->context()->format();
// ///////////////////////////////////////////////////////////////////
// Desired 3.2 Compat Profile
......@@ -234,18 +233,20 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
QOpenGLFunctions_3_2_Compatibility *f32p = this->view->context()->versionFunctions<QOpenGLFunctions_3_2_Compatibility>();
if (f32p) {
// if (true) {
qDebug() << Q_FUNC_INFO << QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_KHR_debug"));
#if 0
// qDebug() << Q_FUNC_INFO << QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_KHR_debug"));
QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
logger->initialize();
// QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
// logger->initialize();
connect(logger, &QOpenGLDebugLogger::messageLogged, [=](const QOpenGLDebugMessage &message) -> void {
qDebug() << Q_FUNC_INFO << message;
});
// connect(logger, &QOpenGLDebugLogger::messageLogged, [=](const QOpenGLDebugMessage &message) -> void {
// qDebug() << Q_FUNC_INFO << message;
// });
logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
// logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
GLfloat vertices[] = { 1, 1, 1, -1, 1, 1, -1,-1, 1, // v0-v1-v2 (front)
-1,-1, 1, 1,-1, 1, 1, 1, 1, // v2-v3-v0
......@@ -286,47 +287,54 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
0, 0, 1, 0, 0, 0, 0, 1, 0, // v4-v7-v6 (back)
0, 1, 0, 0, 1, 1, 0, 0, 1 }; // v6-v5-v4
f32p->initializeOpenGLFunctions();
// f32p->initializeOpenGLFunctions();
f32p->glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_MODELVIEW);
f32p->glLoadIdentity();
glPushMatrix();
glLoadIdentity();
f32p->glEnableClientState(GL_NORMAL_ARRAY);
f32p->glEnableClientState(GL_COLOR_ARRAY);
f32p->glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
f32p->glNormalPointer(GL_FLOAT, 0, normals);
f32p->glColorPointer(3, GL_FLOAT, 0, colors);
f32p->glVertexPointer(3, GL_FLOAT, 0, vertices);
glNormalPointer(GL_FLOAT, 0, normals);
glColorPointer(3, GL_FLOAT, 0, colors);
glVertexPointer(3, GL_FLOAT, 0, vertices);
f32p->glDrawArrays(GL_TRIANGLES, 0, 36);
qDebug() << Q_FUNC_INFO << "Rendering array";
glDrawArrays(GL_TRIANGLES, 0, 36);
f32p->glDisableClientState(GL_VERTEX_ARRAY);
f32p->glDisableClientState(GL_COLOR_ARRAY);
f32p->glDisableClientState(GL_NORMAL_ARRAY);
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glPopMatrix();
#endif // }
QOpenGLFunctions_3_2_Core *f32c = this->view->context()->versionFunctions<QOpenGLFunctions_3_2_Core>();
if (f32c) {
if (false) {
qDebug() << Q_FUNC_INFO << "Core profile with debug?" << QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_KHR_debug"));
// qDebug() << Q_FUNC_INFO << "Core profile with debug?" << this->view->context()->hasExtension(QByteArrayLiteral("GL_KHR_debug"));
QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
logger->initialize();
// QOpenGLDebugLogger *logger = new QOpenGLDebugLogger(this);
// logger->initialize();
connect(logger, &QOpenGLDebugLogger::messageLogged, [=](const QOpenGLDebugMessage &message) -> void {
qDebug() << Q_FUNC_INFO << message;
});
// connect(logger, &QOpenGLDebugLogger::messageLogged, [=](const QOpenGLDebugMessage &message) -> void {
// qDebug() << Q_FUNC_INFO << message;
// });
logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
// logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
static const char *vertexShaderSource =
"#version 150 core\n"
"in vec4 posAttr;\n"
"in vec4 colAttr;\n"
"out vec4 col;\n"
"in mat4 matrix;\n"
"void main() {\n"
" col = colAttr;\n"
" gl_Position = posAttr;\n"
......@@ -340,7 +348,7 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
" color = col;\n"
"}\n";
// f32c->initializeOpenGLFunctions();
f32c->initializeOpenGLFunctions();
static QOpenGLShaderProgram *program = nullptr;
......@@ -352,9 +360,21 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
qDebug() << Q_FUNC_INFO << "Linking program";
}
qDebug() << Q_FUNC_INFO << "Binding program";
glPushMatrix();
glLoadIdentity();
program->bind();
QMatrix4x4 projection;
projection.lookAt(QVector3D(0, 0, 5), QVector3D(0, 0, 0), QVector3D(0, 1, 0));
GLuint posAttr = program->attributeLocation("posAttr");
GLuint colAttr = program->attributeLocation("colAttr");
GLuint matUnif = program->uniformLocation("matrix");
GLfloat vertices[] = {
0.0f, 0.5f,
......@@ -368,9 +388,7 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
0.0f, 0.0f, 1.0f
};
qDebug() << Q_FUNC_INFO << "Binding program";
program->bind();
program->setUniformValue(matUnif, projection);
f32c->glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, 0, vertices);
f32c->glVertexAttribPointer(colAttr, 3, GL_FLOAT, GL_FALSE, 0, colors);
......@@ -384,7 +402,11 @@ void dtkVisualizationDecoratorGL::Render(vtkRenderer *renderer, vtkActor *actor)
f32c->glDisableVertexAttribArray(0);
program->release();
glPopMatrix();
}
this->Modified();
}
// void dtkVisualizationDecoratorGL::release(vtkWindow *window)
......@@ -402,8 +424,6 @@ dtkVisualizationDecoratorGL::dtkVisualizationDecoratorGL(void) : QObject(), vtkM
d = new dtkVisualizationDecoratorGLPrivate;
// d->handler = new dtkVisualizationDecoratorHandler<dtkVisualizationDecoratorGL>(this, &dtkVisualizationDecoratorGL::ReleaseGraphicsResources);
this->StaticOn();
}
dtkVisualizationDecoratorGL::~dtkVisualizationDecoratorGL(void)
......@@ -422,13 +442,36 @@ dtkVisualizationDecoratorGL::~dtkVisualizationDecoratorGL(void)
int main(int argc, char **argv)
{
QSurfaceFormat::setDefaultFormat(dtkVisualizationWidget::defaultFormat());
QSurfaceFormat fmt;
fmt.setRenderableType(QSurfaceFormat::OpenGL);
fmt.setVersion(3, 2);
fmt.setProfile(QSurfaceFormat::CoreProfile);
fmt.setSwapBehavior(QSurfaceFormat::TripleBuffer);
fmt.setRedBufferSize(8);
fmt.setGreenBufferSize(8);
fmt.setBlueBufferSize(8);
fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8);
fmt.setAlphaBufferSize(0);
fmt.setStereo(false);
// fmt.setSamples(vtkOpenGLRenderWindow::GetGlobalMaximumNumberOfMultiSamples());
fmt.setOption(QSurfaceFormat::DebugContext);
QSurfaceFormat::setDefaultFormat(fmt);
qDebug() << "Requested format:";
qDebug() << QSurfaceFormat::defaultFormat();
qDebug() << "";
// QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication application(argc, argv);
dtkVisualizationView3D *view = new dtkVisualizationView3D;
QOpenGLContext *share_context = new QOpenGLContext;
share_context->setFormat(fmt);
share_context->create();
dtkVisualizationView3D *view = new dtkVisualizationView3D(share_context);
view->setWindowTitle("dtkVisualizationDecoratorGL");
view->resize(800, 600);
view->raise();
......@@ -439,19 +482,17 @@ int main(int argc, char **argv)
// Relevant use case
// ///////////////////////////////////////////////////////////////////
#if 1
#if 0
{
dtkVisualizationDecoratorGL *decorator = dtkVisualizationDecoratorGL::New();
decorator->view = view;
vtkActor *actor = vtkActor::New();
vtkOpenGLActor *actor = vtkOpenGLActor::New();
actor->SetMapper(decorator);
view->renderer()->AddActor(actor);
qDebug() << Q_FUNC_INFO << view->renderer();
}
#endif
......@@ -464,7 +505,7 @@ int main(int argc, char **argv)
vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
sphere->SetCenter(0.0, 0.0, 0.0);
sphere->SetRadius(0.5);
sphere->SetRadius(1.0);
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(sphere->GetOutputPort());
......@@ -477,8 +518,7 @@ int main(int argc, char **argv)
}
#endif
view->renderer()->Render();
view->renderer()->ResetCamera();
view->setCameraViewNegativeZ();
// ///////////////////////////////////////////////////////////////////
......
......@@ -85,9 +85,7 @@ target_link_libraries(${PROJECT_NAME} dtkVisualizationWidgets)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
endif(WIN32)
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
## #################################################################
## Target properties
......
......@@ -38,7 +38,7 @@ class dtkVisualizationView3DPrivate : public dtkVisualizationWidget
Q_OBJECT
public:
dtkVisualizationView3DPrivate(QWidget *parent = Q_NULLPTR);
dtkVisualizationView3DPrivate(QOpenGLContext *context = Q_NULLPTR, QWidget *parent = Q_NULLPTR);
~dtkVisualizationView3DPrivate(void);
public slots:
......@@ -68,7 +68,12 @@ public:
dtkVisualizationWidgetsClutEditor *clut;
};
dtkVisualizationView3DPrivate::dtkVisualizationView3DPrivate(QWidget *parent) : dtkVisualizationWidget(parent)
dtkVisualizationView3D::dtkVisualizationView3D(QWidget *parent) : dtkVisualizationView3D(QOpenGLContext::currentContext(), parent)
{
}
dtkVisualizationView3DPrivate::dtkVisualizationView3DPrivate(QOpenGLContext *context, QWidget *parent) : dtkVisualizationWidget(context, parent)
{
this->renderer = vtkSmartPointer<vtkRenderer>::New();
this->renderer->SetBackground(1/*.290*/, 0.295, 0.300);
......@@ -156,9 +161,9 @@ void dtkVisualizationView3DPrivate::resizeEvent(QResizeEvent *event)
// dtkVisualizationView3D
// ///////////////////////////////////////////////////////////////////
dtkVisualizationView3D::dtkVisualizationView3D(QWidget *parent) : dtkWidgetsWidget(parent)
dtkVisualizationView3D::dtkVisualizationView3D(QOpenGLContext *context, QWidget *parent) : dtkWidgetsWidget(parent)
{
d = new dtkVisualizationView3DPrivate(this);
d = new dtkVisualizationView3DPrivate(context, this);
d->q = this;
static int count = 1;
......@@ -261,6 +266,8 @@ void dtkVisualizationView3D::update(void)
if(!enabled)
d->GetInteractor()->Disable();
QWidget::update();
}
void dtkVisualizationView3D::importVTI(const QString& path)
......@@ -513,8 +520,6 @@ void dtkVisualizationView3D::dropEvent(QDropEvent *event)
void dtkVisualizationView3D::keyPressEvent(QKeyEvent *event)
{
event->ignore();
// dtkWidgetsWidget::keyPressEvent(event);
}
// ///////////////////////////////////////////////////////////////////
......
......@@ -33,6 +33,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationView3D : public dtkWidgetsWidget
public:
dtkVisualizationView3D(QWidget *parent = Q_NULLPTR);
dtkVisualizationView3D(QOpenGLContext *context, QWidget *parent = Q_NULLPTR);
~dtkVisualizationView3D(void);
public:
......
......@@ -39,7 +39,7 @@ dtkVisualizationWidget::dtkVisualizationWidget(vtkGenericOpenGLRenderWindow *win
dtkVisualizationWidget::dtkVisualizationWidget(vtkGenericOpenGLRenderWindow *window, QOpenGLContext *context, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
this->internal = new dtkVisualizationWindow(window, context);
QWidget *container = QWidget::createWindowContainer(this->internal, this, f);
container->setAttribute(Qt::WA_TransparentForMouseEvents);
container->setMouseTracking(true);
......@@ -73,7 +73,7 @@ dtkVisualizationWidget::~dtkVisualizationWidget(void)
void dtkVisualizationWidget::setCurrent(void)
{
this->internal->MakeCurrent();
this->internal->makeCurrent();
// this->internal->makeCurrent();
}
void dtkVisualizationWidget::doneCurrent(void)
......
......@@ -26,6 +26,10 @@
#include <vtkOpenGLState.h>
#endif
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLFunctions_1_2>
#include <QtGui/QOpenGLFunctions_3_2_Core>
#include <QtOpenGL>
dtkVisualizationWindow::dtkVisualizationWindow() : dtkVisualizationWindow(nullptr, QOpenGLContext::currentContext(), NoPartialUpdate, Q_NULLPTR)
......@@ -33,23 +37,45 @@ dtkVisualizationWindow::dtkVisualizationWindow() : dtkVisualizationWindow(nullpt
}
dtkVisualizationWindow::dtkVisualizationWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior, QWindow *parent) : dtkVisualizationWindow(nullptr, shareContext, updateBehavior, parent)
dtkVisualizationWindow::dtkVisualizationWindow(QOpenGLContext *context, UpdateBehavior updateBehavior, QWindow *parent) : dtkVisualizationWindow(nullptr, context, updateBehavior, parent)
{
}
dtkVisualizationWindow::dtkVisualizationWindow(vtkGenericOpenGLRenderWindow *w, QOpenGLContext *shareContext, UpdateBehavior updateBehavior, QWindow *parent)
: QOpenGLWindow(shareContext, updateBehavior, parent)
dtkVisualizationWindow::dtkVisualizationWindow(vtkGenericOpenGLRenderWindow *window, QOpenGLContext *context, UpdateBehavior updateBehavior, QWindow *parent)
: QOpenGLWindow(context, updateBehavior, parent)
, EnableHiDPI(false)
, OriginalDPI(0)
, OffscreenSurface(nullptr)
{
qDebug() << Q_FUNC_INFO << shareContext;
this->IrenAdapter = new QVTKInteractorAdapter(this);
this->IrenAdapter->SetDevicePixelRatio(this->devicePixelRatio());
this->EventSlotConnector = vtkSmartPointer<vtkEventQtSlotConnect>::New();
this->SetRenderWindow(w);
this->SetRenderWindow(window);
// ///////////////////////////////////////////////////////////////////
// Here comes the relevant part
// ///////////////////////////////////////////////////////////////////
// this->setFormat(dtkVisualizationWindow::legacyFormat());
this->context_3_2_core = new QOpenGLContext(this);
this->context_3_2_core->setFormat(dtkVisualizationWindow::defaultFormat());
this->context_3_2_core->create();
this->context_1_2_fixed = new QOpenGLContext(this);
this->context_1_2_fixed->setFormat(dtkVisualizationWindow::legacyFormat());
this->context_1_2_fixed->create();
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
// QTimer *timer = new QTimer(this);
// connect(timer, &QTimer::timeout, [=] (void) -> void { this->update(); });
// timer->start(1.0/60.0);
}
dtkVisualizationWindow::~dtkVisualizationWindow(void)
......@@ -144,9 +170,7 @@ void dtkVisualizationWindow::initializeGL(void)
if(!this->RenderWindow)
return;
qDebug() << Q_FUNC_INFO << this->format();
dtkVisualizationWindow::copyFromFormat(this->format(), this->RenderWindow);
dtkVisualizationWindow::copyFromFormat(this->context()->format(), this->RenderWindow);
this->RenderWindow->OpenGLInitContext();
this->RenderWindow->SetReadyForRendering(true);
......@@ -154,6 +178,31 @@ void dtkVisualizationWindow::initializeGL(void)
void dtkVisualizationWindow::paintGL(void)
{
qDebug() << Q_FUNC_INFO << "PAINTGL";
static bool dirty = true;
if (dirty) {
dirty = false;
qDebug() << "ACTUAL CONTEXT AND FORMAT for core" << this->context_3_2_core->format();
qDebug() << "ACTUAL CONTEXT AND FORMAT for legacy" << this->context_1_2_fixed->format();
}
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
this->context_3_2_core->makeCurrent(this);
QOpenGLFunctions_3_2_Core *g = this->context_3_2_core->versionFunctions<QOpenGLFunctions_3_2_Core>();
if (g) {
// g->initializeOpenGLFunctions();
g->glEnable(GL_DEPTH_TEST);
g->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (!this->RenderWindow || !this->isValid() || !this->isExposed())
return;
......@@ -166,19 +215,133 @@ void dtkVisualizationWindow::paintGL(void)
iren->Render();
this->RenderWindow->SetSwapBuffers(swapBuffers);
}
}
this->context_3_2_core->swapBuffers(this);
// this->doneCurrent(); // ?
// ///////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
GLfloat vertices[] = { 1, 1, 1, -1, 1, 1, -1,-1, 1, // v0-v1-v2 (front)
-1,-1, 1, 1,-1, 1, 1, 1, 1, // v2-v3-v0
1, 1, 1, 1,-1, 1, 1,-1,-1, // v0-v3-v4 (right)
1,-1,-1, 1, 1,-1, 1, 1, 1, // v4-v5-v0
1, 1, 1, 1, 1,-1, -1, 1,-1, // v0-v5-v6 (top)
-1, 1,-1, -1, 1, 1, 1, 1, 1, // v6-v1-v0
-1, 1, 1, -1, 1,-1, -1,-1,-1, // v1-v6-v7 (left)
-1,-1,-1, -1,-1, 1, -1, 1, 1, // v7-v2-v1
-1,-1,-1, 1,-1,-1, 1,-1, 1, // v7-v4-v3 (bottom)
1,-1, 1, -1,-1, 1, -1,-1,-1, // v3-v2-v7
1,-1,-1, -1,-1,-1, -1, 1,-1, // v4-v7-v6 (back)
-1, 1,-1, 1, 1,-1, 1,-1,-1 }; // v6-v5-v4
GLfloat normals[] = { 0, 0, 1, 0, 0, 1, 0, 0, 1, // v0-v1-v2 (front)
0, 0, 1, 0, 0, 1, 0, 0, 1, // v2-v3-v0
1, 0, 0, 1, 0, 0, 1, 0, 0, // v0-v3-v4 (right)
1, 0, 0, 1, 0, 0, 1, 0, 0, // v4-v5-v0
0, 1, 0, 0, 1, 0, 0, 1, 0, // v0-v5-v6 (top)
0, 1, 0, 0, 1, 0, 0, 1, 0, // v6-v1-v0
-1, 0, 0, -1, 0, 0, -1, 0, 0, // v1-v6-v7 (left)
-1, 0, 0, -1, 0, 0, -1, 0, 0, // v7-v2-v1
0,-1, 0, 0,-1, 0, 0,-1, 0, // v7-v4-v3 (bottom)
0,-1, 0, 0,-1, 0, 0,-1, 0, // v3-v2-v7
0, 0,-1, 0, 0,-1, 0, 0,-1, // v4-v7-v6 (back)
0, 0,-1, 0, 0,-1, 0, 0,-1 }; // v6-v5-v4
GLfloat colors[] = { 1, 1, 1, 1, 1, 0, 1, 0, 0, // v0-v1-v2 (front)
1, 0, 0, 1, 0, 1, 1, 1, 1, // v2-v3-v0
1, 1, 1, 1, 0, 1, 0, 0, 1, // v0-v3-v4 (right)
0, 0, 1, 0, 1, 1, 1, 1, 1, // v4-v5-v0
1, 1, 1, 0, 1, 1, 0, 1, 0, // v0-v5-v6 (top)
0, 1, 0, 1, 1, 0, 1, 1, 1, // v6-v1-v0
1, 1, 0, 0, 1, 0, 0, 0, 0, // v1-v6-v7 (left)
0, 0, 0, 1, 0, 0, 1, 1, 0, // v7-v2-v1
0, 0, 0, 0, 0, 1, 1, 0, 1, // v7-v4-v3 (bottom)
1, 0, 1, 1, 0, 0, 0, 0, 0, // v3-v2-v7
0, 0, 1, 0, 0, 0, 0, 1, 0, // v4-v7-v6 (back)
0, 1, 0, 0, 1, 1, 0, 0, 1 }; // v6-v5-v4
// f32p->initializeOpenGLFunctions();
static int m_frame = 0;
const qreal retinaScale = devicePixelRatio();
QMatrix4x4 matrix;
matrix.perspective(60.0f, 16.0f/9.0f, 0.1f, 100.0f);
matrix.translate(0, 0, -5);
// matrix.rotate(100.0f * m_frame++ / screen()->refreshRate(), 0, 1, 0);
// this->makeCurrent();
this->context_1_2_fixed->makeCurrent(this);
QOpenGLFunctions_1_2 *f = this->context_1_2_fixed->versionFunctions<QOpenGLFunctions_1_2>();
if (f) {
qDebug() << Q_FUNC_INFO;