代码拉取完成,页面将自动刷新
#ifndef OPENGLWINDOW_H
#define OPENGLWINDOW_H
#include <QtGui/QWindow>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLExtraFunctions>
#include <QQuickView>
QT_BEGIN_NAMESPACE
class QPainter;
class QOpenGLContext;
class QOpenGLPaintDevice;
QT_END_NAMESPACE
class Openglwindow : public QObject, protected QOpenGLExtraFunctions
{
Q_OBJECT
public:
explicit Openglwindow();
~Openglwindow();
//基于QPainter渲染
virtual void render(QPainter *parent);
//基于opengl渲染
virtual void render();
//初始化
virtual void initialize();
//设置动画
void setAnimating(bool animating);
void setViewportSize(const QSize &size) { m_viewportSize = size; }
QSize getViewportSize(){ return m_viewportSize; }
public slots:
//立刻渲染
void renderNow();
void renderLater();
private:
//动画状态位
bool m_animating;
QSize m_viewportSize;
//OpenGL 上下文
QOpenGLContext *m_context;
//OpenGL画笔设备,能使用QPainter在上下文里画东西
QOpenGLPaintDevice *m_device;
bool needsInitialize;
};
#endif // OPENGLWINDOW_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。