在lesson1的基础上加入一个三角形和一个正方形。
#-------------------------------------------------
#
# Project created by QtCreator 2017-01-19T20:33:38
#
#-------------------------------------------------
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = lesson2
TEMPLATE = app
SOURCES += main.cpp \
myglwidget.cpp
HEADERS += \
myglwidget.h
LIBS += -lglut -lGLU
#ifndef MYGLWIDGET_H
#define MYGLWIDGET_H
#include <QGLWidget>
#include <QKeyEvent>
class MyGLWidget : public QGLWidget
{
Q_OBJECT
public:
explicit MyGLWidget(QWidget *parent = 0);
~MyGLWidget();
protected:
virtual void paintGL();
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void keyPressEvent(QKeyEvent *event);
private:
bool mFullScreen;
};
#endif // MYGLWIDGET_H
</