ome-qtwidgets 5.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

GLWindow.h
1 /*
2 * #%L
3 * OME-QTWIDGETS C++ library for display of OME-Files pixel data and metadata.
4 * %%
5 * Copyright © 2014 - 2015 Open Microscopy Environment:
6 * - Massachusetts Institute of Technology
7 * - National Institutes of Health
8 * - University of Dundee
9 * - Board of Regents of the University of Wisconsin-Madison
10 * - Glencoe Software, Inc.
11 * %%
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * The views and conclusions contained in the software and documentation are
34 * those of the authors and should not be interpreted as representing official
35 * policies, either expressed or implied, of any organization.
36 * #L%
37 */
38
39 #ifndef OME_QTWIDGETS_GLWINDOW_H
40 #define OME_QTWIDGETS_GLWINDOW_H
41
42 #include <QtGui/QWindow>
43 #include <QtGui/QOpenGLFunctions>
44 #include <QtGui/QOpenGLDebugMessage>
45
46 QT_BEGIN_NAMESPACE
47 class QPainter;
48 class QOpenGLContext;
49 class QOpenGLPaintDevice;
50 class QOpenGLDebugLogger;
51 QT_END_NAMESPACE
52
53 namespace ome
54 {
55 namespace qtwidgets
56 {
57
65 class GLWindow : public QWindow,
66 protected QOpenGLFunctions
67 {
68 Q_OBJECT
69
70 public:
76 explicit GLWindow(QWindow *parent = 0);
77
79 ~GLWindow();
80
89 virtual void
90 render(QPainter *painter);
91
99 virtual void
100 render();
101
105 virtual void
106 initialize();
107
111 virtual void
112 resize();
113
124 void
125 setAnimating(bool animating);
126
127 public slots:
134 void
135 renderLater();
136
143 void
144 renderNow();
145
154 void
155 logMessage(QOpenGLDebugMessage message);
156
157 protected:
166 bool
167 event(QEvent *event);
168
176 void
177 exposeEvent(QExposeEvent *event);
178
184 void
185 resizeEvent(QResizeEvent *event);
186
192 QOpenGLContext *
193 context() const;
194
198 void
199 makeCurrent();
200
201 private:
203 bool update_pending;
205 bool animating;
207 QOpenGLContext *glcontext;
209 QOpenGLPaintDevice *device;
211 QOpenGLDebugLogger *logger;
212 };
213
214 }
215 }
216
217 #endif // OME_QTWIDGETS_GLWINDOW_H
218
219 /*
220 * Local Variables:
221 * mode:C++
222 * End:
223 */
ome::qtwidgets::GLWindow::exposeEvent
void exposeEvent(QExposeEvent *event)
Handle expose events.
Definition: GLWindow.cpp:126
ome::qtwidgets::GLWindow::renderNow
void renderNow()
Render a frame immediately.
Definition: GLWindow.cpp:153
ome::qtwidgets::GLWindow::~GLWindow
~GLWindow()
Destructor.
Definition: GLWindow.cpp:66
ome::qtwidgets::GLWindow::context
QOpenGLContext * context() const
Get GL context.
Definition: GLWindow.cpp:141
ome::qtwidgets::GLWindow::setAnimating
void setAnimating(bool animating)
Enable or disable animating.
Definition: GLWindow.cpp:217
ome::qtwidgets::GLWindow::device
QOpenGLPaintDevice * device
OpenGL paint device (if render is not reimplemented in subclass).
Definition: GLWindow.h:209
ome::qtwidgets::GLWindow::initialize
virtual void initialize()
Handle initialization of the window.
Definition: GLWindow.cpp:80
ome::qtwidgets::GLWindow::resizeEvent
void resizeEvent(QResizeEvent *event)
Handle resize events.
Definition: GLWindow.cpp:134
ome::qtwidgets::GLWindow::glcontext
QOpenGLContext * glcontext
OpenGL context.
Definition: GLWindow.h:207
ome::qtwidgets::GLWindow::renderLater
void renderLater()
Render a frame at the next opportunity.
Definition: GLWindow.cpp:104
ome
ome::qtwidgets::GLWindow::resize
virtual void resize()
Handle resizing of the window.
Definition: GLWindow.cpp:85
ome::qtwidgets::GLWindow::event
bool event(QEvent *event)
Handle events.
Definition: GLWindow.cpp:113
ome::qtwidgets::GLWindow
Top level GL window.
Definition: GLWindow.h:65
ome::qtwidgets::GLWindow::render
virtual void render()
Render using OpenGL.
Definition: GLWindow.cpp:90
ome::qtwidgets::GLWindow::update_pending
bool update_pending
Update at next opportunity?
Definition: GLWindow.h:203
ome::qtwidgets::GLWindow::animating
bool animating
Animation enabled?
Definition: GLWindow.h:205
ome::qtwidgets::GLWindow::makeCurrent
void makeCurrent()
Make the GL context for this window the current context.
Definition: GLWindow.cpp:147
ome::qtwidgets::GLWindow::GLWindow
GLWindow(QWindow *parent=0)
Create a GL window.
Definition: GLWindow.cpp:55
ome::qtwidgets::GLWindow::logMessage
void logMessage(QOpenGLDebugMessage message)
Log a GL debug message.
Definition: GLWindow.cpp:226
ome::qtwidgets::GLWindow::logger
QOpenGLDebugLogger * logger
OpenGL debug logger (if logging enabled).
Definition: GLWindow.h:211