Overte C++ Documentation
GLWindow.h
1 //
2 // Created by Bradley Austin Davis on 2015/05/21
3 // Copyright 2013 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #pragma once
10 #ifndef hifi_GLWindow_h
11 #define hifi_GLWindow_h
12 
13 #include <mutex>
14 #include <QtGui/QWindow>
15 #include "Context.h"
16 
17 class QOpenGLContext;
18 
19 class GLWindow : public QWindow {
20 public:
21  virtual ~GLWindow();
22  void createContext(QOpenGLContext* shareContext = nullptr);
23  void createContext(const QSurfaceFormat& format, QOpenGLContext* shareContext = nullptr);
24  bool makeCurrent();
25  void doneCurrent();
26  void swapBuffers();
27  QOpenGLContext* context() const;
28 private:
29  gl::Context* _context{ nullptr };
30  std::once_flag _reportOnce;
31 };
32 
33 #endif