Loading...
Searching...
No Matches
glRenderWindow.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_VIEW_RENDERING_GLRENDERWINDOW_H
#define BALL_VIEW_RENDERING_GLRENDERWINDOW_H
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif
#ifndef BALL_VIEW_RENDERING_RENDERWINDOW_H
# include <BALL/VIEW/RENDERING/renderWindow.h>
#endif
#ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
# include <BALL/VIEW/DATATYPE/colorRGBA.h>
#endif
#ifndef BALL_SYSTEM_MUTEX_H
# include <BALL/SYSTEM/mutex.h>
#endif
#include <QtOpenGL/qgl.h>
namespace BALL
{
namespace VIEW
{
class BALL_VIEW_EXPORT GLRenderWindow
: public RenderWindow,
public QGLWidget
{
public:
GLRenderWindow();
GLRenderWindow(QWidget* parent_widget, const char* name = NULL, Qt::WindowFlags w_flags = 0);
GLRenderWindow(const GLRenderWindow& window, QWidget* parent_widget, const char* name = NULL, Qt::WindowFlags w_flags = 0);
virtual ~GLRenderWindow();
/* RenderWindow methods */
virtual bool init();
virtual bool resize(const unsigned int width, const unsigned int height);
virtual void refresh();
// render the given text in the given color and size at window coordinates (x, y)
virtual void renderText(int x, int y, const String& text, const ColorRGBA& color, Size size = 16);
// render the given text in the given color and size at world coordinates (x, y, z)
virtual void renderText(float x, float y, float z, const String& text, const ColorRGBA& color, Size size = 16);
void lockGLContext();
void unlockGLContext();
void ignoreEvents(bool ignore) {ignore_events_ = ignore;}
void setDownsamplingFactor(float dsfactor)
{down_sampling_factor_ = dsfactor;}
void setStereoDelta(float delta)
{stereo_delta_ = delta;}
void setupStereo(float eye_separation, float focal_length);
void safeBufferSwap();
float getDownsamplingFactor() const
{return down_sampling_factor_;}
float stereo_delta_;
protected:
virtual void customEvent(QEvent* evt);
void paintEvent(QPaintEvent* e);
static QGLFormat gl_format_;
// ID of the fullscreen texture used to paste image into GPU framebuffer
GLuint m_screenTexID;
// type of the texture used
GLenum FB_TEXTURE_TARGET;
// format of the GL texture (GL_RGB, GL_RGBA, etc.)
GLenum FB_TEXTURE_FORMAT;
// internal format specified when creating the textures
GLenum FB_INTERNAL_TEXTURE_FORMAT;
// data type of the GL texture (GL_FLOAT, GL_UNSIGNED_INT, etc.)
GLenum FB_TEXTURE_DATATYPE;
void createTexture(const unsigned int winWidth, const unsigned int winHeight);
void deleteTexture();
void checkGL();
bool errorInGL(GLenum& error);
String getGLErrorString(GLenum error);
mutable Mutex contex_mutex_;
bool ignore_events_;
float down_sampling_factor_;
//float stereo_delta_;
};
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_RENDERING_GLRENDERWINDOW_H
global.h
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
BALL::String
Definition string.h:57
BALL::VIEW::ColorRGBA
Definition colorRGBA.h:32
BALL::VIEW::GLRenderWindow::GLRenderWindow
GLRenderWindow(const GLRenderWindow &window, QWidget *parent_widget, const char *name=NULL, Qt::WindowFlags w_flags=0)
BALL::VIEW::GLRenderWindow::errorInGL
bool errorInGL(GLenum &error)
BALL::VIEW::GLRenderWindow::createTexture
void createTexture(const unsigned int winWidth, const unsigned int winHeight)
BALL::VIEW::GLRenderWindow::lockGLContext
void lockGLContext()
Lock the context for the current thread and make it active.
BALL::VIEW::GLRenderWindow::init
virtual bool init()
BALL::VIEW::GLRenderWindow::contex_mutex_
Mutex contex_mutex_
Definition glRenderWindow.h:118
BALL::VIEW::GLRenderWindow::paintEvent
void paintEvent(QPaintEvent *e)
BALL::VIEW::GLRenderWindow::FB_TEXTURE_FORMAT
GLenum FB_TEXTURE_FORMAT
Definition glRenderWindow.h:104
BALL::VIEW::GLRenderWindow::renderText
virtual void renderText(int x, int y, const String &text, const ColorRGBA &color, Size size=16)
BALL::VIEW::GLRenderWindow::setupStereo
void setupStereo(float eye_separation, float focal_length)
BALL::VIEW::GLRenderWindow::FB_TEXTURE_TARGET
GLenum FB_TEXTURE_TARGET
Definition glRenderWindow.h:102
BALL::VIEW::GLRenderWindow::m_screenTexID
GLuint m_screenTexID
Definition glRenderWindow.h:100
BALL::VIEW::GLRenderWindow::setStereoDelta
void setStereoDelta(float delta)
Set the stereo delta for raytracing in pixels.
Definition glRenderWindow.h:73
BALL::VIEW::GLRenderWindow::setDownsamplingFactor
void setDownsamplingFactor(float dsfactor)
Set the window's downsampling factor. This is a speed up factor.
Definition glRenderWindow.h:69
BALL::VIEW::GLRenderWindow::customEvent
virtual void customEvent(QEvent *evt)
BALL::VIEW::GLRenderWindow::~GLRenderWindow
virtual ~GLRenderWindow()
BALL::VIEW::GLRenderWindow::getGLErrorString
String getGLErrorString(GLenum error)
BALL::VIEW::GLRenderWindow::ignoreEvents
void ignoreEvents(bool ignore)
Force the window to ignore paint events.
Definition glRenderWindow.h:66
BALL::VIEW::GLRenderWindow::resize
virtual bool resize(const unsigned int width, const unsigned int height)
BALL::VIEW::GLRenderWindow::GLRenderWindow
GLRenderWindow()
BALL::VIEW::GLRenderWindow::getDownsamplingFactor
float getDownsamplingFactor() const
Get the window's downsampling factor.
Definition glRenderWindow.h:82
BALL::VIEW::GLRenderWindow::unlockGLContext
void unlockGLContext()
Unlock the context for the current thread and make it active.
BALL::VIEW::GLRenderWindow::ignore_events_
bool ignore_events_
Definition glRenderWindow.h:119
BALL::VIEW::GLRenderWindow::renderText
virtual void renderText(float x, float y, float z, const String &text, const ColorRGBA &color, Size size=16)
BALL::VIEW::GLRenderWindow::down_sampling_factor_
float down_sampling_factor_
Definition glRenderWindow.h:120
BALL::VIEW::GLRenderWindow::GLRenderWindow
GLRenderWindow(QWidget *parent_widget, const char *name=NULL, Qt::WindowFlags w_flags=0)
BALL::VIEW::GLRenderWindow::FB_INTERNAL_TEXTURE_FORMAT
GLenum FB_INTERNAL_TEXTURE_FORMAT
Definition glRenderWindow.h:106
BALL::VIEW::GLRenderWindow::refresh
virtual void refresh()
BALL::VIEW::GLRenderWindow::gl_format_
static QGLFormat gl_format_
Definition glRenderWindow.h:97
BALL::VIEW::GLRenderWindow::safeBufferSwap
void safeBufferSwap()
Call swapBuffers() but first make sure the window is exposed.
BALL::VIEW::GLRenderWindow::FB_TEXTURE_DATATYPE
GLenum FB_TEXTURE_DATATYPE
Definition glRenderWindow.h:108
BALL::VIEW::GLRenderWindow::stereo_delta_
float stereo_delta_
Definition glRenderWindow.h:85
BALL::VIEW::GLRenderWindow::deleteTexture
void deleteTexture()
BALL::VIEW::GLRenderWindow::checkGL
void checkGL()
QEvent
QGLWidget
QWidget
colorRGBA.h
mutex.h
BALL::VIEW
Definition constraints.h:35
BALL::VIEW::RenderWindow
TRenderWindow< BALL_DEFAULT_PIXEL_TYPE > RenderWindow
Definition renderWindow.h:115
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Mutex
TMutex< BALL_DEFAULT_MUTEX_TYPE > Mutex
Definition mutex.h:224
renderWindow.h
string.h