本文主要是介绍Qt_OpenGL:光照纹理滤波色彩混合小测,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Qt_OpenGL:光照纹理滤波色彩混合小测
此测试程序包含了光照、纹理滤波和色彩融合等知识点。
//.h
#ifndef GLWIDGET_H
#define GLWIDGET_H#include <QtOpenGL>
#include <QWidget>class GLWidget : public QGLWidget
{Q_OBJECTpublic:explicit GLWidget(QGLWidget *parent = 0);~GLWidget();protected:void initializeGL();void paintGL();void resizeGL(int width, int height);void keyPressEvent(QKeyEvent *e);void loadTextures();bool fullscreen;GLuint texture[3];private:float rotate_angle;float zoom;float rotate_speed;int filter;bool light;bool blend;};#endif // GLWIDGET_H
//.cpp
<pre name="code" class="cpp"><pre name="code" class="cpp">#include "glwidget.h"
#include <QtGui>
#include <QtCore>
#include <QtOpenGL>
#include <glut.h>static const GLfloat light_ambient[4]={0.5, 0.5, 0.5, 1.0};
static const GLfloat light_diffuse[4]={1.0, 1.0, 1.0, 1.0};
static const GLfloat light_position[4]={0.0, 0.0, 2.0, 0.0};GLWidget::GLWidget(QGLWidget *parent) :QGLWidget(parent)
{// setCaption("The Opengl for Qt Framework");fullscreen =
这篇关于Qt_OpenGL:光照纹理滤波色彩混合小测的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!