BALL 1.5.0
glRenderWindow.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_VIEW_RENDERING_GLRENDERWINDOW_H
6#define BALL_VIEW_RENDERING_GLRENDERWINDOW_H
7
8#ifndef BALL_COMMON_GLOBAL_H
9# include <BALL/COMMON/global.h>
10#endif
11
12#ifndef BALL_DATATYPE_STRING_H
13# include <BALL/DATATYPE/string.h>
14#endif
15
16#ifndef BALL_VIEW_RENDERING_RENDERWINDOW_H
18#endif
19
20#ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
22#endif
23
24#ifndef BALL_SYSTEM_MUTEX_H
25# include <BALL/SYSTEM/mutex.h>
26#endif
27
28#include <QtOpenGL/qgl.h>
29
30namespace BALL
31{
32 namespace VIEW
33 {
38 : public RenderWindow,
39 public QGLWidget
40 {
41
42 public:
44 GLRenderWindow(QWidget* parent_widget, const char* name = NULL, Qt::WindowFlags w_flags = 0);
45 GLRenderWindow(const GLRenderWindow& window, QWidget* parent_widget, const char* name = NULL, Qt::WindowFlags w_flags = 0);
46
47 virtual ~GLRenderWindow();
48
49 /* RenderWindow methods */
50 virtual bool init();
51 virtual bool resize(const unsigned int width, const unsigned int height);
52 virtual void refresh();
53
54 // render the given text in the given color and size at window coordinates (x, y)
55 virtual void renderText(int x, int y, const String& text, const ColorRGBA& color, Size size = 16);
56 // render the given text in the given color and size at world coordinates (x, y, z)
57 virtual void renderText(float x, float y, float z, const String& text, const ColorRGBA& color, Size size = 16);
58
61
64
66 void ignoreEvents(bool ignore) {ignore_events_ = ignore;}
67
69 void setDownsamplingFactor(float dsfactor)
70 {down_sampling_factor_ = dsfactor;}
71
73 void setStereoDelta(float delta)
74 {stereo_delta_ = delta;}
75
76 void setupStereo(float eye_separation, float focal_length);
77
80
83 {return down_sampling_factor_;}
84
86
87 protected:
88
94 virtual void customEvent(QEvent* evt);
95
96 void paintEvent(QPaintEvent* e);
97 static QGLFormat gl_format_;
98
99 // ID of the fullscreen texture used to paste image into GPU framebuffer
101 // type of the texture used
103 // format of the GL texture (GL_RGB, GL_RGBA, etc.)
105 // internal format specified when creating the textures
107 // data type of the GL texture (GL_FLOAT, GL_UNSIGNED_INT, etc.)
109
110 void createTexture(const unsigned int winWidth, const unsigned int winHeight);
112
113 void checkGL();
114
115 bool errorInGL(GLenum& error);
117
121 //float stereo_delta_;
122 };
123
124 } // namespace VIEW
125
126} // namespace BALL
127
128#endif // BALL_VIEW_RENDERING_GLRENDERWINDOW_H
Definition: constants.h:13
GLRenderWindow(const GLRenderWindow &window, QWidget *parent_widget, const char *name=NULL, Qt::WindowFlags w_flags=0)
bool errorInGL(GLenum &error)
void createTexture(const unsigned int winWidth, const unsigned int winHeight)
void lockGLContext()
Lock the context for the current thread and make it active.
void paintEvent(QPaintEvent *e)
virtual void renderText(int x, int y, const String &text, const ColorRGBA &color, Size size=16)
void setupStereo(float eye_separation, float focal_length)
void setStereoDelta(float delta)
Set the stereo delta for raytracing in pixels.
void setDownsamplingFactor(float dsfactor)
Set the window's downsampling factor. This is a speed up factor.
virtual void customEvent(QEvent *evt)
String getGLErrorString(GLenum error)
void ignoreEvents(bool ignore)
Force the window to ignore paint events.
virtual bool resize(const unsigned int width, const unsigned int height)
float getDownsamplingFactor() const
Get the window's downsampling factor.
void unlockGLContext()
Unlock the context for the current thread and make it active.
virtual void renderText(float x, float y, float z, const String &text, const ColorRGBA &color, Size size=16)
GLRenderWindow(QWidget *parent_widget, const char *name=NULL, Qt::WindowFlags w_flags=0)
static QGLFormat gl_format_
void safeBufferSwap()
Call swapBuffers() but first make sure the window is exposed.
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52