1 Star 5 Fork 3

chen227 / OpenglAndQml

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
openglwindow.cpp 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
chen227 提交于 2018-05-24 13:47 . opengl 上层界面追加
#include "openglwindow.h"
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLPaintDevice>
#include <QtGui/QPainter>
Openglwindow::Openglwindow()
:m_animating(false)
,m_context(0)
,m_device(0)
{
needsInitialize = true;
}
Openglwindow::~Openglwindow()
{
//删除设备
delete m_device;
m_context->makeCurrent(0);
}
void Openglwindow::render(QPainter *painter)
{
Q_UNUSED(painter);
}
void Openglwindow::initialize()
{
}
void Openglwindow::render()
{
//清除屏幕, 颜色缓冲区和深度缓冲区和模板缓冲区
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
void Openglwindow::renderLater()
{
renderNow();
}
void Openglwindow::renderNow()
{
if (needsInitialize) {
//初始化当前上下文的OpenGL函数解析
initializeOpenGLFunctions();
initialize();
needsInitialize = false;
}
render();
if (m_animating)
renderLater();
}
void Openglwindow::setAnimating(bool animating)
{
m_animating = animating;
if (animating)
renderLater();
}
1
https://gitee.com/chen227/OpenglAndQml.git
git@gitee.com:chen227/OpenglAndQml.git
chen227
OpenglAndQml
OpenglAndQml
master

搜索帮助