code format
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "openglwindow.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLPaintDevice>
|
||||
@@ -6,7 +7,7 @@
|
||||
#include <qopenglext.h>
|
||||
|
||||
|
||||
OpenGLWindow::OpenGLWindow(QWindow *parent) : QWindow(parent) {
|
||||
OpenGLWindow::OpenGLWindow(QWindow * parent): QWindow(parent) {
|
||||
setFlags(flags() | Qt::FramelessWindowHint);
|
||||
setSurfaceType(QWindow::OpenGLSurface);
|
||||
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
|
||||
@@ -29,18 +30,15 @@ void OpenGLWindow::renderLater() {
|
||||
}
|
||||
|
||||
|
||||
bool OpenGLWindow::event(QEvent *event) {
|
||||
bool OpenGLWindow::event(QEvent * event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::UpdateRequest:
|
||||
renderNow();
|
||||
return true;
|
||||
default:
|
||||
return QWindow::event(event);
|
||||
case QEvent::UpdateRequest: renderNow(); return true;
|
||||
default: return QWindow::event(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenGLWindow::exposeEvent(QExposeEvent *event) {
|
||||
void OpenGLWindow::exposeEvent(QExposeEvent * event) {
|
||||
if (isExposed()) renderNow();
|
||||
}
|
||||
|
||||
@@ -68,19 +66,19 @@ bool OpenGLWindow::getVSync() const {
|
||||
}
|
||||
|
||||
|
||||
//void OpenGLWindow::setSamples(int samples) {
|
||||
// void OpenGLWindow::setSamples(int samples) {
|
||||
// QSurfaceFormat f = requestedFormat();
|
||||
// if (f.samples() != samples) {
|
||||
// f.setSamples(samples);
|
||||
// setFormat(f);
|
||||
// format_change = true;
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
|
||||
//int OpenGLWindow::getSamples() const {
|
||||
// int OpenGLWindow::getSamples() const {
|
||||
// return requestedFormat().samples();
|
||||
//}
|
||||
// }
|
||||
|
||||
|
||||
void OpenGLWindow::renderNow() {
|
||||
@@ -92,7 +90,7 @@ void OpenGLWindow::renderNow() {
|
||||
m_context->setFormat(requestedFormat());
|
||||
m_context->create();
|
||||
needsInitialize = true;
|
||||
format_change = false;
|
||||
format_change = false;
|
||||
}
|
||||
m_context->makeCurrent(this);
|
||||
if (needsInitialize) {
|
||||
@@ -103,4 +101,3 @@ void OpenGLWindow::renderNow() {
|
||||
m_context->swapBuffers(this);
|
||||
frame_cnt++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user