GLWidget Class Reference

#include <glwidget.h>

List of all members.

Public Slots

void setXRotation (int angle)
void setYRotation (int angle)
void setZRotation (int angle)
void setLength (int length)
void setWidth (int width)
void setDepth (int depth)
void setColors ()
void setRenderMode (bool mode)

Signals

void xRotationChanged (int angle)
void yRotationChanged (int angle)
void zRotationChanged (int angle)

Public Member Functions

 GLWidget (QWidget *parent=0)
QSize minimumSizeHint () const
QSize sizeHint () const
void setVolume (Volume *newVolume)
void setColorsPtr (unsigned int *colorsPtr)

Protected Member Functions

void initializeGL ()
void paintGL ()
void resizeGL (int width, int height)
void mousePressEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void wheelEvent (QWheelEvent *event)

Private Member Functions

void drawSlice ()
void normalizeAngle (int *angle)
char * file2string (const std::string &strFilename)
GLuint loadShader (const std::string &strFilename)
void printLog (GLuint obj)
void setVertexProp (float s, float t, float p)
void renderBoundingBox ()
void genTransferTexture ()
void initBackfaceBuffer ()
void updateRelVolSize ()


Detailed Description

Sets up a Qt OpenGl Canvas Widget.

Constructor & Destructor Documentation

GLWidget::GLWidget ( QWidget *  parent = 0  ) 

Sets up a Qt OpenGl Canvas.

Parameters:
parent is the parent window of the canvas.


Member Function Documentation

QSize GLWidget::minimumSizeHint (  )  const

Returns:
The minimum size for the Widget.

QSize GLWidget::sizeHint (  )  const

Returns:
The size hint for the Widget.

void GLWidget::setVolume ( Volume newVolume  ) 

Sets up the Canvas for a new Volume object.

Parameters:
newVolume is the new Volume.

void GLWidget::setColorsPtr ( unsigned int *  colorsPtr  ) 

Initializes the pointer to the transferfunction array.

Parameters:
colorsPtr is the pointer to the new array.

void GLWidget::setXRotation ( int  angle  )  [slot]

Handles rotation of the volume around the X-axis.

Parameters:
angle is the new X-angle.

void GLWidget::setYRotation ( int  angle  )  [slot]

Handles rotation of the volume around the Y-axis.

Parameters:
angle is the new Y-angle.

void GLWidget::setZRotation ( int  angle  )  [slot]

Handles rotation of the volume around the Z-axis.

Parameters:
angle is the new Z-angle.

void GLWidget::setLength ( int  length  )  [slot]

Sets the position and the slice shown by the YZ-Quad in slicemode.

Parameters:
length is the position of the new slice ([0 .. 1] * 5760).

void GLWidget::setWidth ( int  width  )  [slot]

Sets the position and the slice shown by the XZ-Quad in slicemode.

Parameters:
width is the position of the new slice ([0 .. 1] * 5760).

void GLWidget::setDepth ( int  depth  )  [slot]

Sets the position and the slice shown by the XY-Quad in slicemode.

Parameters:
depth is the position of the new slice ([0 .. 1] * 5760).

void GLWidget::setColors (  )  [slot]

Updatefunction, called whenever the transferfunction is changed. Sends the new transfertexture to the graphics card.

void GLWidget::setRenderMode ( bool  mode  )  [slot]

Sets the current Rendermode.

Parameters:
mode is the new renderMode (0 - raycasting, 1 - sliceview)

void GLWidget::xRotationChanged ( int  angle  )  [signal]

A signal that is send on a change in the x rotation.

Parameters:
angle is the angle of the new rotation.

void GLWidget::yRotationChanged ( int  angle  )  [signal]

A signal that is send on a change in the y rotation.

Parameters:
angle is the angle of the new rotation.

void GLWidget::zRotationChanged ( int  angle  )  [signal]

A signal that is send on a change in the z rotation.

Parameters:
angle is the angle of the new rotation.

void GLWidget::initializeGL (  )  [protected]

Initialzes the OpenGl environment including lighting, textures and shaders.

void GLWidget::paintGL (  )  [protected]

Applys affine transformations and starts the drawing of the frame.

void GLWidget::resizeGL ( int  width,
int  height 
) [protected]

Handles resizing of the OpenGl canvas.

Parameters:
width is the new width of the canvas.
height is the new height of the canvas.

void GLWidget::mousePressEvent ( QMouseEvent *  event  )  [protected]

Reduces the stepsize of the raycastingshader and initialises volume rotations.

Parameters:
event is the mousePressEvent.

void GLWidget::mouseReleaseEvent ( QMouseEvent *  event  )  [protected]

Increases the stepsize of the raycastingshader after finished volume rotations.

Parameters:
event is the mouseReleaseEvent.

void GLWidget::mouseMoveEvent ( QMouseEvent *  event  )  [protected]

Handles mouse dragging and rotation of the volume.

Parameters:
event is the mouseMoveEvent.

void GLWidget::wheelEvent ( QWheelEvent *  event  )  [protected]

Handles mouseWheelEvents.

Parameters:
event is the mouseWheelEvent.

void GLWidget::drawSlice (  )  [private]

Renders the 3d-Objects if the current rendermode. Rendermode 0: Raycastingview, renders boundingbox backside into the FBO and frontside into the normal buffer. Rendermode 1: Sliceview, draws 3 Quads depending on current lengthf, widthf and heightf.

void GLWidget::normalizeAngle ( int *  angle  )  [private]

Keeps angle within [0 360] interval.

Parameters:
angle is the pointer to the angle.

char * GLWidget::file2string ( const std::string &  strFilename  )  [private]

Loads a binary file into a Charpointer.

Parameters:
strFilename ist the filename of the file to load.
Returns:
The Charpointer with the content of the file.

GLuint GLWidget::loadShader ( const std::string &  strFilename  )  [private]

Handels loading, compiling and attaching of a vertex-, fragmentshader pair to a shader program.

Parameters:
strFilename is the filepath of the shaders without extension. Loading requires 2 glsl shader files with "<filepath>.vert" and "<filepath>.frag" extension to be successful.
Returns:
The id of the new shaderprogram.

void GLWidget::printLog ( GLuint  obj  )  [private]

Prints the shaderobject debug log.

Parameters:
obj specifies the shaderobject.

void GLWidget::setVertexProp ( float  s,
float  t,
float  p 
) [private]

Sets glColor and glTexCoords with the given parameters.

Parameters:
s 
t 
p 

void GLWidget::renderBoundingBox (  )  [private]

Renders the boundingbox of the volume with the longest side normalized to 1.

void GLWidget::genTransferTexture (  )  [private]

Generates the Transferfunction-texture and sends it to the graphics card.

void GLWidget::initBackfaceBuffer (  )  [private]

Generates framebufferobject and texture for the backface rendering.

void GLWidget::updateRelVolSize (  )  [private]

Calculates the relative volumesizes the the longest side normalized to 1.


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

Generated on Tue Dec 9 22:48:07 2008 by  doxygen 1.5.6