default unlimit fps, vsync flag

This commit is contained in:
Бычков Андрей
2022-10-12 14:35:01 +03:00
parent c865f9fc94
commit 3b0d1ea0e2
7 changed files with 119 additions and 100 deletions

View File

@@ -1,21 +1,3 @@
/*
QGL OpenGLWindow
Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QWindow>
#include <QOpenGLExtraFunctions>
@@ -24,17 +6,21 @@ class QOpenGLContext;
class QOpenGLPaintDevice;
class OpenGLWindow: public QWindow, public QOpenGLExtraFunctions
{
class OpenGLWindow : public QWindow, public QOpenGLExtraFunctions {
Q_OBJECT
public:
explicit OpenGLWindow(QWindow *parent = nullptr);
~OpenGLWindow();
virtual ~OpenGLWindow() {}
virtual void render() {}
virtual void initialize() {}
virtual void render(QPainter *painter);
virtual void render();
virtual void initialize();
QOpenGLContext * context() {return m_context;}
void setVSync(bool on);
bool getVSync() const;
void setSamples(int samples);
int getSamples() const;
int getFrameCounter() const {return frame_cnt;}
public slots:
void renderLater();
@@ -45,7 +31,8 @@ protected:
void exposeEvent(QExposeEvent *event) override;
private:
QOpenGLContext *m_context;
QOpenGLPaintDevice *m_device;
QOpenGLContext * m_context = nullptr;
bool format_change = false;
int frame_cnt = 0;
};