I have a simple UI with a button, after pressing the button I should open a new window where OpenGL stuff should be drawn. I'm trying to do this with QOpenGLWidget but the InitializeGL() and paintGL() functions are never called.
So basically I have my main with a function that should start everything:
void test::displayOpenGLObjects
{
newOpenGLContext = std::make_unique(this);
}
Visualization_OpenGL.cpp
test::Visualization_OpenGL(QWidget *parent): QOpenGLWidget(parent)
{
QOpenGLWidget *test_window = new QOpenGLWidget();
test_window->setWindowTitle("OpenGL Visualization");
test_window->makeCurrent();
test_window->show();
}
test::initializeGL(){
...
}
test::paintGL(){
...
}
test::resizeGL(){
...
}
And the header:
class Visualization_OpenGL : public QOpenGLWidget, public QOpenGLFunctions
{
Q_OBJECT
public:
Visualization_OpenGL(QWidget *parent);
~Visualization_OpenGL();
protected:
void initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
};
The examples I've seen all draw everything on the mainwindow, and when I do it like that, the paintGL() and initializeGL() are indeed called, but I need to have a separate window for this, I'm guessing my problem is something involving the QOpenGLWidget *test_window = new QOpenGLWidget(); but I'm not sure how to fix. I'm super new with this so I'm sorry if this is a super noob question, but any help will be appreciated.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)