Qt Creator + OpenGL
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they followed, or recommend to others, when getting started with OpenGL inside a Qt widget application.
Recommended by 3 people across 2 different months, 2013 to 2021.
What it is
A roughly 13 minute screencast showing how to set up an OpenGL view inside a Qt Creator project. It walks through subclassing QGLWidget, promoting a form widget to that class, and drawing a simple colored triangle. It is posted by the channel josuehmachado with no written description.
What people said
Recommends Detective King · 2013-03 · Stack Overflow · on “QT the glBegin not declared?”
i'm following a tutorial to write a small piece of code of opengl in qt.here's the link [this video] but in the 6:13 when I bluid the code it show a couple of error that ..\testopgl\glwidget.cpp: In member function 'virtual void GLWidget::paintGL()': ..\testopgl\glwidget.cpp:17:20: error: 'glColor3f' was not declared in this scope ..\testopgl\glwidget.cpp:19:25: error: 'glBegin' was not declared in this scope ..\testopgl\glwidget.cpp:20:31: error: 'glVertex3f' was not declared in this scope ..\testopgl\glwidget.cpp:23:11: error: 'glEnd' was not declared in this scope ..\testopgl\glwidget.cpp: At global scope: what I really don't understand is when I only put the glClear(GL_COLOR_BUFFER_BIT) it bu
Recommends LemonCool · 2013-03 · Stack Overflow · on “Overpainting and post-render effects on QGLView (not QGLWidget) in Qt3D”
resize and events are easy to implement specially if you make a class inherit from qglwidget here is a short video that should help you get started [this video] in regards to drawing images and text qt has the qpainter that can help you in doing that, use QGLContext ( [LINK] ) to pass it the current context and render your label/image/widget at the specific cordinate, but make sure that this function call is the last in your paint event otherwise it will not be on top to react to mouse event make your class include QMouseEvent header then you can get the coordinates of the mouse within the widget and pass them to opengl by overloading the protected event mouseMoveEvent(QMouseEvent *event){event->
Recommends Aaron Hagan · 2013-07 · Stack Overflow · on “User interface for an OpenGL project?”
Have you considered using QT for the GUI portions of your project ? You can create a panel for QT buttons and GUIs. You could use the QGLWidget for your panel to view the animation. A good tutorial for using Qt Creator with Opengl ( [this video] ). There are also many good examples of the OpenGL + QT + Visual studio in the "C:\QtInstallPath\examples\opengl" directory. If you wanted didn't want to use QT you could use C++\CLI to assist with the GUI portions of the code. The following link shows how to create an OpenGL view on a windows form in managed C++. [LINK] .
Cites abcdef · 2013-02 · Stack Overflow · on “Linking glut to Qt”
I want to combine OpenGL with glut to Qt. I'm using Windows. My version of Qt is 4.7.4, 32 bit. I followed the tutorial: [this video] I also checked some other questions of people but they didn't gave me an answer. The part before including glut works fine. But when I try to include glut it doesn't work. The errors are: undefined reference to glutInit_ATEXIT_HACK and more undefined references to glutfunctions. I copied the glut-libraries and headers to the appropriate folders in the MinGW folder. But I wasn't sure if this was the right folder.
Cites abcdef · 2013-02 · Stack Overflow · on “Setup glut to Qt Creator”
I want to combine OpenGL with glut with Qt creator. I'm using Windows, my version of QT is 4.7.4, 32 bit. I followed the tutorial: [this video] I also checked some other questions of people but they didn't gave me an anwer. The part before including glut works fine. But when I trie to include glut it doesn't work. The errors are: undefined reference to glutInit_ATEXIT_HACK and more undefined references to glutfunctions. I copied the glut-libraries and headers to the appropriate folders in the Minwg folder. But I wasn't sure if this was the right folder. Do I have to get special libraries of glut and OpenGL for Qt? And where do I have to place them?
Cites user3815068 · 2014-07 · Stack Overflow · on “opengl + Qtwidget don't work”
I'm creat a opengl program in qt application, and I'm using this video tutorial for this [this video] . But my widget don't work, it does show image, only the image that was behind the screen. this and an example (from is my opengl view): [LINK] And this is my codes: my Qtwidget view: #include "telafotos.h" #include "ui_telafotos.h" TelaFotos::TelaFotos(QWidget *parent) : QWidget(parent), ui(new Ui::TelaFotos) { ui->setupUi(this); } TelaFotos::~TelaFotos() { delete ui; } My QGLWidget: #include "imagemfestivalgl.h" ImagemFestivalGl::ImagemFestivalGl(QWidget *parent) : QGLWidget(parent) { } void ImagemFestivalGl::initializeGL(){ glClearColor(1,1,0,1); } void ImagemFestivalGl::paintGL(){ } void Imag
Cites Szczepan · 2014-10 · Stack Overflow · on “Can't display OpenGL in Qwidget”
I want to make simple opengl project as in this [this video] tutorial. I add new class GLWidget that inherit from QGLWidget, and promote my QWidget object to GLWidget class that i already made. When i run project i can't refresh QWidget object. Every time i see what's behind that window when I build and run project. This is how it should look like Correct [LINK] And this is what it really looks not correct [LINK] . GLWidget.h #ifndef GLWIDGET_H #define GLWIDGET_H #include <GL/glew.h> #include <QGLWidget> #include <QTimer> class GLWidget : public QGLWidget { Q_OBJECT public: explicit GLWidget(QWidget *parent = 0); GLWidget(int width, int height); void initializeGL(); void paintGL(); void resizeGL(
Cites Tony · 2014-10 · Stack Overflow · on “Qt-opengl-debug-SIGSEGV-how to fix?”
I follow tutorial on this: [this video] 1/test_opengl.pro ============================================== QT += core gui opengl greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = test_opengl TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp \ glwidget.cpp HEADERS += mainwindow.h \ glwidget.h FORMS += mainwindow.ui ================================================ 2/glwidget.h ================================================ #ifndef GLWIDGET_H #define GLWIDGET_H #include <QGLWidget> class GLWidget : public QGLWidget { Q_OBJECT public: explicit GLWidget(QWidget *parent = 0); void initializeGL(); void paintGL(); void resizeGL(int w, int h); }; #endif // GLWIDGET_H ==============================
Cites Poriferous · 2015-01 · Stack Overflow · on “Qt/OpenGL - rendered primitives are distorted”
I was following a tutorial on youtube on how to use OpenGL within Qt. I have two classes: glWidget -> Inherits from QGLWidget; GLWindow -> Inherits from QMainWindow and has a form. Within GLWindow's form I place a Widget and promote it to glWidget so that whatever is rendered on glWidget is displayed through Widget on GLWindow. I implement the following inherited functions in glWidget: void glWidget::initializeGL() { glClearColor(0.1, 0.1, 0.1, 1.0); } void glWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glColor3f(0.2, 0.8, 0.1); glVertex3f(-0.5, -0.5, 0.0); glColor3f(0.8, 0.3, 0.9); glVertex3f(0.5, -0.5, 0.0); glColor3f(0.1, 0.1, 0.5); glVertex3f(0.0, 0.5, 0.0); g
Cites Đỗ Minh Quốc · 2015-04 · Stack Overflow · on “Increase OpenGL display size”
I'm just starting to learn OpenGL in Qt, and I've been following a demo clip from [this video] , but my display is not same as the display in clip. It looks very small. Is there any way to make it bigger? I tried to change to the coordinates of the triangle drawing code like: glColor3f(1,1,0); glScalef(1, 1, 0.0); glBegin(GL_TRIANGLES); glVertex3f(-10,-10,0); glVertex3f(10,-10,0); glVertex3f(0.0,10,0); glEnd(); But, it didn't draw a triangle. My output became a square. See these screen shots for before [LINK] and after [LINK] my changes.