comparison Samples/Qt/QStoneOpenGlWidget.cpp @ 863:23701fbf228e am-dev

first rendering of a 2DScene in Qt widget
author Alain Mazy <alain@mazy.be>
date Mon, 24 Jun 2019 16:29:49 +0200
parents 8a8cf2991538
children 12b591d5d63c
comparison
equal deleted inserted replaced
860:238693c3bc51 863:23701fbf228e
1 #include "../../Framework/OpenGL/OpenGLIncludes.h" 1 #include "../../Framework/OpenGL/OpenGLIncludes.h"
2 #include "QStoneOpenGlWidget.h" 2 #include "QStoneOpenGlWidget.h"
3 3
4 void QStoneOpenGlWidget::initializeGL() 4 void QStoneOpenGlWidget::initializeGL()
5 { 5 {
6 // Set up the rendering context, load shaders and other resources, etc.: 6 glewInit();
7 QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); 7 }
8 f->glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 8
9 void QStoneOpenGlWidget::MakeCurrent()
10 {
11 this->makeCurrent();
9 } 12 }
10 13
11 void QStoneOpenGlWidget::resizeGL(int w, int h) 14 void QStoneOpenGlWidget::resizeGL(int w, int h)
12 { 15 {
13 16
14 } 17 }
15 18
16 void QStoneOpenGlWidget::paintGL() 19 void QStoneOpenGlWidget::paintGL()
17 { 20 {
18 makeCurrent();
19
20 // // Draw the scene:
21 // QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
22 // f->glClear(GL_COLOR_BUFFER_BIT);
23 // f->glClearColor(1.0f, 0.3f, 0.5f, 1.0f);
24
25 if (compositor_) 21 if (compositor_)
26 { 22 {
27 compositor_->Refresh(); 23 compositor_->Refresh();
28 } 24 }
29 doneCurrent(); 25 doneCurrent();