0
Probably, Opengl is the only thing I can’t use in Qt, maya and 3ds and other Autodesk programs use opengl in Qt, but no tutorial or example that works.
I already created a class for the widget based on Qopenglwidget (Since Qglwidget is obsolete), then in the Ui editor I add a widget and promote the class I created.
Result, when I compile a white screen with no menus or anything with the frozen screen, then the application crasha.
Several tutorials do this way and it works, but with me always gives the same result, the application crasha.
https://www.youtube.com/watch?v=A-PRoXR_62Q https://www.youtube.com/watch?v=1nzHSkY4K18
They all work in video, except in practice.
glpanel code. h
#include <QtOpenGL>
class GLPanel : public QOpenGLWidget, protected QOpenGLFunctions{
Q_OBJECT
public:
explicit GLPanel(QWidget *parent = 0);
protected:
void initializeGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
};
glpanel code.cpp
#include "glpanel.h"
GLPanel::GLPanel(QWidget *parent) :
QOpenGLWidget(parent)
{
}
void GLPanel::initializeGL()
{
initializeOpenGLFunctions();
}
void GLPanel::resizeGL(int w, int h)
{
}
void GLPanel::paintGL()
{
}
ui code
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Ives 3D</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="GLPanel" name="Viewport" native="true"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="action_Exit"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="action_Exit">
<property name="text">
<string>&Exit</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>GLPanel</class>
<extends>QWidget</extends>
<header>glpanel.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Someone can give me a light ?!!
may be video driver problem, have you tested any opengl without using the QT library? In general AMD GPU are quite problematic on linux.
– paulocanedo
the most recent official example I believe is this one: http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html
– paulocanedo
I do not use linux, use windows, When I create a uniquely Opengl application using Glew or SDL usually everything works, but if I try to use in Qt does not work, the proper widget of Qt crashes the application and promoting a widget too
– Samuel Ives
try the example of this link I gave you, it is very different from what you published, maybe it works.
– paulocanedo
The problem is that I will use as widget, I am developing a simple modeling program so I need toolbars, layouts, etc
– Samuel Ives