Schemer
Schemer

Reputation: 1665

OpenGL: Execution Flow of QApplication

I am trying to trace the path of execution in some C++ OpenGL starter code but the main method does almost nothing more than this:

QApplication app(argc, argv);
MainWindow main_window;
main_window.resize(QSize(width, height));
main_window.show();
return app.exec();

These are the .h and .cpp files:

GLShape.h    GLTransformStack.h  main.cpp         Matrix4x4.h
GLState.cpp  GLWidget.cpp        MainWindow.h
GLState.h    GLWidget.h          Matrix3x3.h

It seems fairly obvious what the all of the various functionalities are, but I can't find where anything is being called/instantiated. I suspect this is being done behind the scenes by QApplication.

Is there a standard flow of execution for QApplication relative to these files?

In particular, I want to create an animation organized as a tree of shapes. To do this, I am trying to add a class PivotGroup that holds groups of shapes all associated with with a point of rotation. Each PivotGroup has vector of PivotGroup children so that a tree can be constructed.

Where is the best place for the code to create the tree? It seems to make sense as a widget, but I can't tell if one or many widgets are being created.

Upvotes: 1

Views: 135

Answers (1)

user3256930
user3256930

Reputation: 1143

Usually when using OpenGL with Qt the GLWidget class would be instantiated in the constructor of the MainWindow class both of which are inheriting from a Qt class. You can also add additional widgets to the MainWindow there.

Upvotes: 2

Related Questions