KGLLib
Public Slots | Public Member Functions | Protected Member Functions
KGLLib::HdrGLWidget Class Reference
Inheritance diagram for KGLLib::HdrGLWidget:
KGLLib::GLWidget

List of all members.

Public Slots

void setHdrRenderingActive (bool active)
void setExposure (float e)
void setAutoExposure (bool a)
void setAutoExposureSpeed (float s)
void setAutoExposureTarget (float t)
void setBloomEnabled (bool e)
void setBloomAfterTonemapping (bool e)
void setBloomDownsize (int d)
void setBloomStrength (float s)

Public Member Functions

 HdrGLWidget (QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=0)
 HdrGLWidget (QGLContext *context, QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=0)
 HdrGLWidget (const QGLFormat &format, QWidget *parent=0, const QGLWidget *shareWidget=0, Qt::WindowFlags f=0)
bool hdrRenderingActive () const
bool hdrRenderingSupported () const
float exposure () const
bool autoExposure () const
float autoExposureSpeed () const
float autoExposureTarget () const
bool bloomEnabled () const
bool bloomAfterTonemapping () const
int bloomDownsize () const
float bloomStrength () const
float bloomRamp () const
void render2DQuad (float width, float height) const
void setupOrthoProjection (int width, int height) const
void activateRenderTarget (RenderTarget *target) const
void deactivateRenderTarget (RenderTarget *target) const
void setDataPath (const QString &path)

Protected Member Functions

virtual void initializeGL ()
virtual void initializeGL (Renderer *r)
virtual void resizeGL (int width, int height)
virtual void render ()
virtual void renderScene ()
virtual void hdrTonemapping ()
virtual void hdrBloom ()
virtual void calculateHdrExposure ()
virtual float * calculateBlurKernel (float sigma, int radius)
virtual ProgramgenerateBlurProgram (float sigma, int radius, bool horizontal)
virtual ShadergenerateBlurVertexShader (float sigma, int radius, bool horizontal)
virtual ShadergenerateBlurFragmentShader (float sigma, int radius, bool horizontal)

Member Function Documentation

bool KGLLib::HdrGLWidget::autoExposure ( ) const [inline]
Returns:
whether automatic exposure adjustment is enabled. See setAutoExposure for more info.
float KGLLib::HdrGLWidget::exposure ( ) const [inline]
Returns:
current exposure, used for tonemapping. This is either set using setExposure or calculated automatically when automatic exposure adjustment is enabled.
bool KGLLib::HdrGLWidget::hdrRenderingActive ( ) const [inline]
Returns:
whether HDR rendering is currently active.

Referenced by render().

bool KGLLib::HdrGLWidget::hdrRenderingSupported ( ) const [inline]
Returns:
whether HDR rendering is supported on this hardware.
void KGLLib::HdrGLWidget::initializeGL ( ) [protected, virtual]

Initializes OpenGL. Base implementation:

  • calls KGLLib::init() to initialize KGLLib
  • creates camera and fpsCounter objects
  • sets OpenGL clear color to clearColor
  • initializes camera to look from (0, 0, 5) at (0, 0, 0) with depth range [1, 100]
  • enables depth testing (if depth buffer is used)
  • sets OpenGL shade model to GL_SMOOTH
  • sets primary color to white

Reimplemented from KGLLib::GLWidget.

Referenced by initializeGL().

void KGLLib::HdrGLWidget::initializeGL ( Renderer r) [protected, virtual]

Same as above but passes the specified Renderer object to KGLLib::init().

Reimplemented from KGLLib::GLWidget.

References initializeGL().

void KGLLib::HdrGLWidget::render ( ) [protected, virtual]

Called from paintGL() when the widget needs to be painted. This is the method that you should reimplement to do your rendering. Base implementation does nothing, so you needn't call it from your implementation.

Reimplemented from KGLLib::GLWidget.

References KGLLib::TextureBase::disable(), KGLLib::TextureBase::enable(), hdrRenderingActive(), and KGLLib::TextureBase::setFilter().

void KGLLib::HdrGLWidget::resizeGL ( int  width,
int  height 
) [protected, virtual]

Called when the widget is resized. Base implementation:

  • sets up a new viewport, covering the entire widget
  • updates camera's aspect and applies the camera

Reimplemented from KGLLib::GLWidget.

void KGLLib::HdrGLWidget::setAutoExposure ( bool  a) [inline, slot]

Enables or disables automatic exposure adjustment. When enabled, exposure is automatically calculated every frame after calling renderScene. Automatic exposure adjustment is disabled by default.

void KGLLib::HdrGLWidget::setDataPath ( const QString &  path)

Sets the data path where HdrGLWidget will look for shaders.

void KGLLib::HdrGLWidget::setExposure ( float  e) [inline, slot]

Set current exposure, used for tonemapping. Default exposure is 1.0

Note that this has no effect when automatic exposure adjustment has been enabled (see setAutoExposure).

void KGLLib::HdrGLWidget::setHdrRenderingActive ( bool  active) [inline, slot]

Activates or deactivates HDR rendering. Note that if HDR rendering isn't supported on current hardware then it has no effect and HDR rendering will never be active.


The documentation for this class was generated from the following files: