一.效果
二.实现
pro文件
QT -=gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = lesson1
TEMPLATE = app
SOURCES += main.cpp\
HEADERS += glut.h
LIBS+= -lglut32 -lopengl32 -lglu32
main.cpp
#include <windows.h>
#include <math.h>
#include "glut.h"
/*
*
* 彩色旋转立方体
* 1. 定义六个面,同时定义每个顶点的颜色(与顶点坐标相对应)
* 2. 启用 GL_SMOOTH 方式渲染
*
*
*/
static float xrot = 0.0;
static float yrot = 0.0;
static float zrot = 0.0;
void cube()
{
glBegin(GL_QUADS);
glC