Moved obj and mtl file loading to main instead
This commit is contained in:
parent
22d1b57a48
commit
26336815b4
3 changed files with 5 additions and 4 deletions
|
@ -8,6 +8,7 @@ class OPGLWidget : public QOpenGLWidget
|
|||
Q_OBJECT
|
||||
public:
|
||||
OPGLWidget(QWidget *parent) : QOpenGLWidget(parent) {}
|
||||
ObjectLoader obj;
|
||||
public slots:
|
||||
void paintGL();
|
||||
void update_camera();
|
||||
|
@ -29,7 +30,6 @@ protected:
|
|||
float right[3] = {1, 0, 0};
|
||||
float vel[3] = {0, 0, 0};
|
||||
float speed = 0;
|
||||
ObjectLoader obj;
|
||||
bool key_states[6] = {false, false, false, false, false, false};
|
||||
float mouse_loc_old[2];
|
||||
};
|
||||
|
|
|
@ -8,6 +8,10 @@ int main(int argc, char **argv) {
|
|||
QMainWindow w;
|
||||
Ui::MainWindow ui;
|
||||
ui.setupUi(&w);
|
||||
|
||||
ui.openGLWidget->obj.load_mtl("untitled.mtl");
|
||||
ui.openGLWidget->obj.load_obj("untitled.obj");
|
||||
|
||||
QTimer timer_draw;
|
||||
QTimer timer_cam;
|
||||
w.connect(&timer_draw, SIGNAL(timeout()), ui.openGLWidget, SLOT(paintGL()));
|
||||
|
|
|
@ -21,9 +21,6 @@ void OPGLWidget::initializeGL() {
|
|||
glLightfv(GL_LIGHT0, GL_SPECULAR, light_array);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
obj.load_mtl("untitled.mtl");
|
||||
obj.load_obj("untitled.obj");
|
||||
}
|
||||
|
||||
void OPGLWidget::paintGL() {
|
||||
|
|
Loading…
Reference in a new issue