GLBox Class Reference

Image + OpenGL widget. More...

#include <glbox.h>

Inheritance diagram for GLBox:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 GLBox (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0)
 Create a GLBox widget.
 GLBox (const QGLFormat &format, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0)
 ~GLBox ()
 Release allocated resources.
void screenToImageCoord (int sx, int sy, float *imx, float *imy) const
void imageToScreenCoord (float x, float y, int *sx, int *sy) const
void translate (float dx, float dy)
 translate image of (dx,dy).
void zoom (float sx, float sy)
void setAxisUp (bool up)
void setImageSpace ()
void setImage (IplImage *image)
void loadGlTexture (IplImage *im)
bool renderAndSave (const char *filename, int w=720, int h=576)
 off screen rendering.
void setupTransform ()
 GLBox (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0)
 GLBox (const QGLFormat &format, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0)
 ~GLBox ()
void screenToImageCoord (int sx, int sy, float *imx, float *imy) const
void imageToScreenCoord (float x, float y, int *sx, int *sy) const
void translate (float dx, float dy)
 translate image of (dx,dy).
void zoom (float sx, float sy)
void setAxisUp (bool up)
void setImageSpace ()
void setImage (IplImage *image)
void loadGlTexture (IplImage *im)
bool renderAndSave (const char *filename, int w=720, int h=576)
 off screen rendering.
void setupTransform ()

Static Public Member Functions

static GLuint genGlTexture (int texWidth, int texHeight, bool smooth=false)
static GLuint genGlTexture (int texWidth, int texHeight, bool smooth=false)

Public Attributes

bool reloadImage
bool allowCache
float dx
float dy
float sx
float sy
bool yAxisUp
bool smooth

Protected Member Functions

virtual void initializeGL ()
 Set up the OpenGL rendering state, and define display list.
virtual void paintGL ()
 Paint the box.
virtual void resizeGL (int w, int h)
 Set up the OpenGL view port, matrix mode, etc.
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void wheelEvent (QWheelEvent *e)
virtual void mousePressEvent (QMouseEvent *e)
virtual void saveContext ()
virtual void restoreContext ()
void loadTexture ()
void invertAffine ()
virtual void initializeGL ()
virtual void paintGL ()
virtual void resizeGL (int w, int h)
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void wheelEvent (QWheelEvent *e)
virtual void mousePressEvent (QMouseEvent *e)
virtual void saveContext ()
virtual void restoreContext ()
void loadTexture ()
void invertAffine ()

Protected Attributes

IplImage * image
GLuint texture
GLuint savedTexture
int textureWidth
int textureHeight
float affineTransf [2][3]
float invAffineTransf [2][3]


Detailed Description

Image + OpenGL widget.

Definition at line 41 of file glbox.h.


Constructor & Destructor Documentation

GLBox::GLBox ( QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0 
)

Create a GLBox widget.

Definition at line 51 of file glbox.cpp.

GLBox::GLBox ( const QGLFormat &  format,
QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0 
)

Definition at line 57 of file glbox.cpp.

GLBox::~GLBox (  ) 

Release allocated resources.

Definition at line 81 of file glbox.cpp.

References texture.

GLBox::GLBox ( QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0 
)

GLBox::GLBox ( const QGLFormat &  format,
QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0 
)

GLBox::~GLBox (  ) 


Member Function Documentation

static GLuint GLBox::genGlTexture ( int  texWidth,
int  texHeight,
bool  smooth = false 
) [static]

GLuint GLBox::genGlTexture ( int  texWidth,
int  texHeight,
bool  smooth = false 
) [static]

Definition at line 168 of file glbox.cpp.

Referenced by loadGlTexture().

void GLBox::imageToScreenCoord ( float  x,
float  y,
int *  sx,
int *  sy 
) const

void GLBox::imageToScreenCoord ( float  x,
float  y,
int *  sx,
int *  sy 
) const

Definition at line 228 of file glbox.cpp.

References affineTransf, and image.

virtual void GLBox::initializeGL (  )  [protected, virtual]

void GLBox::initializeGL (  )  [protected, virtual]

Set up the OpenGL rendering state, and define display list.

Definition at line 159 of file glbox.cpp.

References reloadImage.

void GLBox::invertAffine (  )  [protected]

void GLBox::invertAffine (  )  [protected]

Definition at line 470 of file glbox.cpp.

References affineTransf, and invAffineTransf.

Referenced by setupTransform().

void GLBox::loadGlTexture ( IplImage *  im  ) 

void GLBox::loadGlTexture ( IplImage *  im  ) 

Definition at line 390 of file glbox.cpp.

References genGlTexture(), smooth, texture, textureHeight, and textureWidth.

Referenced by loadTexture().

void GLBox::loadTexture (  )  [protected]

void GLBox::loadTexture (  )  [protected]

Definition at line 381 of file glbox.cpp.

References allowCache, image, loadGlTexture(), reloadImage, and texture.

Referenced by paintGL().

virtual void GLBox::mouseMoveEvent ( QMouseEvent *  e  )  [protected, virtual]

void GLBox::mouseMoveEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 440 of file glbox.cpp.

References dx, dy, screenToImageCoord(), and setupTransform().

virtual void GLBox::mousePressEvent ( QMouseEvent *  e  )  [protected, virtual]

Reimplemented in VSView, and vobj_tracker_view.

void GLBox::mousePressEvent ( QMouseEvent *  e  )  [protected, virtual]

Reimplemented in VSView, and vobj_tracker_view.

Definition at line 433 of file glbox.cpp.

virtual void GLBox::paintGL (  )  [protected, virtual]

Reimplemented in VSView, and vobj_tracker_view.

void GLBox::paintGL (  )  [protected, virtual]

Paint the box.

The actual openGL commands for drawing the box are performed here.

Reimplemented in VSView, and vobj_tracker_view.

Definition at line 94 of file glbox.cpp.

References image, loadTexture(), setImageSpace(), smooth, textureHeight, textureWidth, and yAxisUp.

Referenced by renderAndSave().

bool GLBox::renderAndSave ( const char *  filename,
int  w = 720,
int  h = 576 
)

off screen rendering.

create a GL context, call initializeGL() and paintGL(), and save the result to the PNG or JPG file specified as argument.

Parameters:
w image width. If 0, uses the current widget width.
h image height. If 0, uses the current widget height.
Returns:
true on success, false on error.

bool GLBox::renderAndSave ( const char *  filename,
int  w = 720,
int  h = 576 
)

off screen rendering.

create a GL context, call initializeGL() and paintGL(), and save the result to the PNG or JPG file specified as argument.

Parameters:
w image width. If 0, uses the current widget width.
h image height. If 0, uses the current widget height.
Returns:
true on success, false on error.

Definition at line 362 of file glbox.cpp.

References paintGL().

Referenced by vobj_tracker_view::keyPressEvent(), VSView::keyPressEvent(), vobj_tracker_view::timerEvent(), and VSView::timerEvent().

virtual void GLBox::resizeGL ( int  w,
int  h 
) [protected, virtual]

void GLBox::resizeGL ( int  w,
int  h 
) [protected, virtual]

Set up the OpenGL view port, matrix mode, etc.

Definition at line 192 of file glbox.cpp.

Referenced by vobj_tracker_view::paintGL(), and VSView::paintGL().

virtual void GLBox::restoreContext (  )  [protected, virtual]

void GLBox::restoreContext (  )  [protected, virtual]

Definition at line 358 of file glbox.cpp.

References savedTexture, and texture.

virtual void GLBox::saveContext (  )  [protected, virtual]

void GLBox::saveContext (  )  [protected, virtual]

Definition at line 354 of file glbox.cpp.

References savedTexture, and texture.

void GLBox::screenToImageCoord ( int  sx,
int  sy,
float *  imx,
float *  imy 
) const

void GLBox::screenToImageCoord ( int  sx,
int  sy,
float *  imx,
float *  imy 
) const

Definition at line 206 of file glbox.cpp.

References image, and invAffineTransf.

Referenced by mouseMoveEvent().

void GLBox::setAxisUp ( bool  up  )  [inline]

Definition at line 61 of file glbox.h.

References setupTransform(), and yAxisUp.

void GLBox::setAxisUp ( bool  up  )  [inline]

Definition at line 61 of file glbox.h.

References setupTransform(), and yAxisUp.

Referenced by vobj_tracker_view::paintGL(), and VSView::paintGL().

void GLBox::setImage ( IplImage *  image  ) 

void GLBox::setImage ( IplImage *  image  ) 

void GLBox::setImageSpace (  ) 

void GLBox::setImageSpace (  ) 

Definition at line 314 of file glbox.cpp.

References affineTransf, and image.

Referenced by vobj_tracker_view::paintGL(), VSView::paintGL(), and paintGL().

void GLBox::setupTransform (  ) 

void GLBox::setupTransform (  ) 

Definition at line 246 of file glbox.cpp.

References affineTransf, dx, dy, image, invertAffine(), sx, sy, and yAxisUp.

Referenced by mouseMoveEvent(), setAxisUp(), translate(), wheelEvent(), and zoom().

void GLBox::translate ( float  dx,
float  dy 
) [inline]

translate image of (dx,dy).

Use 0,0 for normal centered rendering (default). dx points toward right, dy points up. Dx, dy are expressed in pixels.

Definition at line 59 of file glbox.h.

References setupTransform().

void GLBox::translate ( float  dx,
float  dy 
) [inline]

translate image of (dx,dy).

Use 0,0 for normal centered rendering (default). dx points toward right, dy points up. Dx, dy are expressed in pixels.

Definition at line 59 of file glbox.h.

References setupTransform().

Referenced by vobj_tracker_view::keyPressEvent(), and VSView::keyPressEvent().

virtual void GLBox::wheelEvent ( QWheelEvent *  e  )  [protected, virtual]

void GLBox::wheelEvent ( QWheelEvent *  e  )  [protected, virtual]

Definition at line 454 of file glbox.cpp.

References setupTransform(), sx, and sy.

void GLBox::zoom ( float  sx,
float  sy 
) [inline]

Definition at line 60 of file glbox.h.

References setupTransform().

void GLBox::zoom ( float  sx,
float  sy 
) [inline]

Definition at line 60 of file glbox.h.

References setupTransform().

Referenced by vobj_tracker_view::keyPressEvent(), VSView::keyPressEvent(), and VSView::VSView().


Member Data Documentation

float GLBox::affineTransf [protected]

Definition at line 125 of file glbox.h.

Referenced by imageToScreenCoord(), invertAffine(), setImageSpace(), and setupTransform().

Definition at line 55 of file glbox.h.

Referenced by loadTexture().

float GLBox::dx

Definition at line 93 of file glbox.h.

Referenced by mouseMoveEvent(), and setupTransform().

float GLBox::dy

Definition at line 93 of file glbox.h.

Referenced by mouseMoveEvent(), and setupTransform().

IplImage * GLBox::image [protected]

float GLBox::invAffineTransf [protected]

Definition at line 126 of file glbox.h.

Referenced by invertAffine(), and screenToImageCoord().

Definition at line 54 of file glbox.h.

Referenced by initializeGL(), loadTexture(), and setImage().

GLuint GLBox::savedTexture [protected]

Definition at line 118 of file glbox.h.

Referenced by restoreContext(), and saveContext().

Definition at line 98 of file glbox.h.

Referenced by loadGlTexture(), and paintGL().

float GLBox::sx

Definition at line 94 of file glbox.h.

Referenced by setupTransform(), and wheelEvent().

float GLBox::sy

Definition at line 94 of file glbox.h.

Referenced by setupTransform(), and wheelEvent().

GLuint GLBox::texture [protected]

Definition at line 118 of file glbox.h.

Referenced by loadGlTexture(), loadTexture(), restoreContext(), saveContext(), and ~GLBox().

int GLBox::textureHeight [protected]

Definition at line 119 of file glbox.h.

Referenced by loadGlTexture(), and paintGL().

int GLBox::textureWidth [protected]

Definition at line 119 of file glbox.h.

Referenced by loadGlTexture(), and paintGL().

Definition at line 96 of file glbox.h.

Referenced by paintGL(), setAxisUp(), and setupTransform().


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

Generated on Tue Mar 30 15:53:25 2010 for Polyora by  doxygen 1.5.9