Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

RenderWindow Class Reference

Combines a QGLWidget of qt with a vtkRenderWindow of vtk. More...

#include <renderwindow.h>

Inheritance diagram for RenderWindow:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 RenderWindow (QGLFormat glf, QWidget *parent=0, const char *name=0)
 Constructs a new RenderWindow.

 RenderWindow (QWidget *parent=0, const char *name=0)
 Constructs a new RenderWindow.

 ~RenderWindow ()
 Destructs the RenderWindow.

vtkRenderer * GetRenderer ()
 returns the vtkRenderer used

vtkRenderWindow * GetRenderWindow ()
 returns the vtkRenderWindow used


Protected Member Functions

virtual void paintGL ()
 Render the scene.

virtual void initializeGL ()
 Initialize the OpenGL Window.

virtual void resizeGL (int w, int h)
 Resize the OpenGL Window.


Private Member Functions

void InitRenderWindow ()
 Initialize the RenderWindow.


Private Attributes

bool initNeeded
vtkRenderer * renderer
vtkRenderWindow * renderWindow
vtkLight * light

Detailed Description

Combines a QGLWidget of qt with a vtkRenderWindow of vtk.

This class combines the great GUI toolkit qt (www.troll.no) with the great visualization toolkit vtk (www.kitware.com/vtk).

Version:
Revision
1.3
Author:
Jan Stifter j.stifter@medres.ch. Original idea and code from Tom Radcliffe radcliffe@igotechnologies.com.
Date:
Date
2000/09/14 14:56:10
Thanks to:
Kuno Meyer <meyerk@student.ethz.ch>, Marcel van Straten <streets@mediaport.org> Kent Vander Velden <graphix@iastate.edu>
History:
      $Log: renderwindow.cpp,v $
      Revision 1.3  2000/09/14 14:56:10  jstifter
      Changes proposed from Kent Vander Velden <graphix@iastate.edu>
      CameraRotate, CameraTranslate, CameraZoom problems fixed (mostly due to
      incorrect clipping)

      Revision 1.2  2000/09/14 13:25:43  jstifter
      Added Support for *parent, *name in the constructors

      Revision 1.1.1.1  2000/08/15 09:36:39  jstifter
      first cvs import

Definition at line 14 of file renderwindow.h.


Constructor & Destructor Documentation

RenderWindow::RenderWindow QGLFormat  glf,
QWidget *  parent = 0,
const char *  name = 0
 

Constructs a new RenderWindow.

The new RenderWindow has a vtkRenderWindow, a vtkRenderer and a vtkLight initialized

Parameters:
glf the QGLFormat, which will be passed directly to the underlying QGLWidget
parent directly passed to QGLWidget
name directly passed to QGLWidget

Definition at line 48 of file renderwindow.cpp.

References InitRenderWindow().

00049   : QGLWidget(glf, parent, name) {
00050    this->InitRenderWindow();
00051 }

Here is the call graph for this function:

RenderWindow::RenderWindow QWidget *  parent = 0,
const char *  name = 0
 

Constructs a new RenderWindow.

The new RenderWindow has a vtkRenderWindow, a vtkRenderer and a vtkLight initialized

Parameters:
parent directly passed to QGLWidget
name directly passed to QGLWidget

Definition at line 62 of file renderwindow.cpp.

References InitRenderWindow().

00063   : QGLWidget(parent, name) {
00064    this->InitRenderWindow();
00065 }

Here is the call graph for this function:

RenderWindow::~RenderWindow  ) 
 

Destructs the RenderWindow.

Definition at line 93 of file renderwindow.cpp.

References renderer, and renderWindow.

00093                             {
00094    this->renderer->Delete();
00095    this->renderWindow->Delete();
00096 }


Member Function Documentation

vtkRenderer * RenderWindow::GetRenderer  ) 
 

returns the vtkRenderer used

Definition at line 101 of file renderwindow.cpp.

References renderer.

Referenced by RenderWindowInteractor::ActorPlaneRoll(), RenderWindowInteractor::ActorRoll(), RenderWindowInteractor::ActorRotate(), RenderWindowInteractor::CameraRoll(), RenderWindowInteractor::CameraRotate(), RenderWindowInteractor::CameraZoom(), RenderWindowInteractor::DisplayToWorld(), RenderWindowInteractor::InitRenderWindowInteractor(), MainWindow::newSubdivision(), and RenderWindowInteractor::WorldToDisplay().

00101                                        {
00102    return this->renderer;
00103 }

vtkRenderWindow * RenderWindow::GetRenderWindow  ) 
 

returns the vtkRenderWindow used

Definition at line 108 of file renderwindow.cpp.

References renderWindow.

Referenced by RenderWindowInteractor::ActorRotate(), and RenderWindowInteractor::CameraRotate().

00108                                                 {
00109    return this->renderWindow;
00110 }

void RenderWindow::initializeGL  )  [protected, virtual]
 

Initialize the OpenGL Window.

Definition at line 115 of file renderwindow.cpp.

00115                                  {
00116   glClearColor(1.0, 1.0, 1.0, 1.0);
00117   glColor3f(1.0, 0.0, 0.0);
00118 }

void RenderWindow::InitRenderWindow  )  [private]
 

Initialize the RenderWindow.

This method is called from the two Constructors

Definition at line 72 of file renderwindow.cpp.

References initNeeded, light, renderer, and renderWindow.

Referenced by RenderWindow().

00072                                     {
00073    this->initNeeded = true;
00074    this->renderWindow = vtkRenderWindow::New();
00075    this->renderer = vtkRenderer::New();
00076    this->renderWindow->AddRenderer( this->renderer );
00077    this->light = vtkLight::New();
00078    this->renderer->AddLight( this->light );
00079    // just enable one double buffering
00080    // by default, we use the one of vtk
00081    #ifdef QT_DOUBLEBUFFER
00082       // use the double buffering of QT
00083       this->renderWindow->SetSwapBuffers(0);
00084    #else
00085       // use the double buffering of vtk
00086       this->setAutoBufferSwap( false );
00087    #endif
00088 }

void RenderWindow::paintGL  )  [protected, virtual]
 

Render the scene.

Definition at line 135 of file renderwindow.cpp.

References initNeeded, and renderWindow.

00136 {
00137    // Get the native window ID and pass it
00138    // to the VTK render window
00139    // before we render for the first time...
00140    if (this->initNeeded) {
00141       WId nId = winId();
00142       this->renderWindow->SetWindowId( (void*) nId );
00143       this->initNeeded = false;
00144    }
00145    else {
00146       this->renderWindow->Render();
00147    }
00148 }

void RenderWindow::resizeGL int  w,
int  h
[protected, virtual]
 

Resize the OpenGL Window.

Definition at line 123 of file renderwindow.cpp.

00123                                          {
00124   glMatrixMode( GL_PROJECTION );
00125   glLoadIdentity();
00126   gluOrtho2D( 0.0, w, 0.0, h );
00127   glMatrixMode( GL_MODELVIEW );
00128 
00129   updateGL();
00130 }


Member Data Documentation

bool RenderWindow::initNeeded [private]
 

Definition at line 34 of file renderwindow.h.

Referenced by InitRenderWindow(), and paintGL().

vtkLight* RenderWindow::light [private]
 

Definition at line 37 of file renderwindow.h.

Referenced by InitRenderWindow().

vtkRenderer* RenderWindow::renderer [private]
 

Definition at line 35 of file renderwindow.h.

Referenced by GetRenderer(), InitRenderWindow(), and ~RenderWindow().

vtkRenderWindow* RenderWindow::renderWindow [private]
 

Definition at line 36 of file renderwindow.h.

Referenced by GetRenderWindow(), InitRenderWindow(), paintGL(), and ~RenderWindow().


The documentation for this class was generated from the following files:
Generated on Sun Jun 22 12:13:17 2003 for Catmull Clark by doxygen 1.3.2