1 Star 0 Fork 0

chen227 / opengl_OpenGLFunctions8

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
openglwindow.h 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
chen227 提交于 2018-05-22 15:03 . 半透明效果
#ifndef OPENGLWINDOW_H
#define OPENGLWINDOW_H
#include <QtGui/QWindow>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLExtraFunctions>
QT_BEGIN_NAMESPACE
class QPainter;
class QOpenGLContext;
class QOpenGLPaintDevice;
QT_END_NAMESPACE
class Openglwindow : public QWindow, protected QOpenGLExtraFunctions
{
Q_OBJECT
public:
explicit Openglwindow(QWindow *parent=0);
~Openglwindow();
//基于QPainter渲染
virtual void render(QPainter *parent);
//基于opengl渲染
virtual void render();
//初始化
virtual void initialize();
//设置动画
void setAnimating(bool animating);
public slots:
//手动刷新一次
void renderLater();
//立刻渲染
void renderNow();
protected:
//监听事件
bool event(QEvent *event) override;
//监听暴露事件
void exposeEvent(QExposeEvent *event) override;
private:
//动画状态位
bool m_animating;
//OpenGL 上下文
QOpenGLContext *m_context;
//OpenGL画笔设备,能使用QPainter在上下文里画东西
QOpenGLPaintDevice *m_device;
};
#endif // OPENGLWINDOW_H
1
https://gitee.com/chen227/opengl_OpenGLFunctions8.git
git@gitee.com:chen227/opengl_OpenGLFunctions8.git
chen227
opengl_OpenGLFunctions8
opengl_OpenGLFunctions8
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891