Ok i'm posting other files
glwidget.h
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
{
public:
GLWidget();
void initializeGL();
void paintGL();
void resizeGL(int w,int h);
explicit GLWidget
(QWidget *parent
= 0);
};
#endif // GLWIDGET_H
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
class GLWidget : public QGLWidget
{
public:
GLWidget();
void initializeGL();
void paintGL();
void resizeGL(int w,int h);
explicit GLWidget(QWidget *parent = 0);
};
#endif // GLWIDGET_H
To copy to clipboard, switch view to plain text mode
MainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= nullptr
);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
glwidget.cpp
#include "glwidget.h"
#include <GL/glut.h>
{
}
GLWidget::GLWidget()
{
}
void GLWidget::initializeGL()
{
glClearColor(0,1,0,1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
}
void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5,0,0,0,0,1,0);
glColor3f(1,0,0);
glutSolidSphere(1,20,20);
}
void GLWidget::resizeGL(int w, int h)
{
}
#include "glwidget.h"
#include <GL/glut.h>
GLWidget::GLWidget(QWidget *parent):QGLWidget(parent)
{
}
GLWidget::GLWidget()
{
}
void GLWidget::initializeGL()
{
glClearColor(0,1,0,1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
}
void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5,0,0,0,0,1,0);
glColor3f(1,0,0);
glutSolidSphere(1,20,20);
}
void GLWidget::resizeGL(int w, int h)
{
}
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
Bookmarks