Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

vtkMitkRectangleProp Class Reference

#include <vtkMitkRectangleProp.h>

List of all members.

Public Member Functions

 vtkTypeMacro (vtkMitkRectangleProp, vtkProp)
int RenderOpaqueGeometry (vtkViewport *viewport)
int RenderTranslucentGeometry (vtkViewport *viewport)
int RenderOverlay (vtkViewport *viewport)
void SetRenderWindow (vtkRenderWindow *renWin)
void SetColor (float col1, float col2, float col3)
double * GetBounds ()

Static Public Member Functions

static vtkMitkRectanglePropNew ()

Protected Member Functions

 vtkMitkRectangleProp ()
virtual ~vtkMitkRectangleProp ()
void Enable2DOpenGL ()
void Disable2DOpenGL ()

Protected Attributes

vtkRenderWindow * m_RenderWindow
float m_Color [3]

Detailed Description

Definition at line 26 of file vtkMitkRectangleProp.h.


Constructor & Destructor Documentation

vtkMitkRectangleProp::vtkMitkRectangleProp (  ) [protected]

Definition at line 25 of file vtkMitkRectangleProp.cpp.

{
}
vtkMitkRectangleProp::~vtkMitkRectangleProp (  ) [protected, virtual]

Definition at line 29 of file vtkMitkRectangleProp.cpp.

{
}

Member Function Documentation

void vtkMitkRectangleProp::Disable2DOpenGL (  ) [protected]
void vtkMitkRectangleProp::Enable2DOpenGL (  ) [protected]

Definition at line 93 of file vtkMitkRectangleProp.cpp.

References GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, GL_LIGHTING, GL_LIGHTING_BIT, GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE_2D, GL_VIEWPORT, glDisable(), glGetIntegerv(), glLoadIdentity(), glMatrixMode(), glOrtho(), glPushAttrib(), and glPushMatrix().

Referenced by RenderOverlay().

{
  GLint iViewport[4];  
   
  // Get a copy of the viewport  
  glGetIntegerv( GL_VIEWPORT, iViewport );  
   
  // Save a copy of the projection matrix so that we can restore it  
  // when it's time to do 3D rendering again.  
  glMatrixMode( GL_PROJECTION );  
  glPushMatrix();  
  glLoadIdentity();  
   
  // Set up the orthographic projection  
  glOrtho( iViewport[0], iViewport[0]+iViewport[2],  
  iViewport[1]+iViewport[3], iViewport[1], -1, 1 );  
  glMatrixMode( GL_MODELVIEW );  
  glPushMatrix();  
  glLoadIdentity();  
   
  // Make sure depth testing and lighting are disabled for 2D rendering until  
  // we are finished rendering in 2D  
  glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT | GL_TEXTURE_2D);
  glDisable( GL_DEPTH_TEST );  
  glDisable( GL_LIGHTING   );
  glDisable( GL_TEXTURE_2D );
}
double * vtkMitkRectangleProp::GetBounds (  )

Definition at line 33 of file vtkMitkRectangleProp.cpp.

{
  return NULL;
}
static vtkMitkRectangleProp* vtkMitkRectangleProp::New (  ) [static]
int vtkMitkRectangleProp::RenderOpaqueGeometry ( vtkViewport *  viewport )

Definition at line 88 of file vtkMitkRectangleProp.cpp.

{
  return 0;
}
int vtkMitkRectangleProp::RenderOverlay ( vtkViewport *  viewport )

Definition at line 38 of file vtkMitkRectangleProp.cpp.

References Disable2DOpenGL(), Enable2DOpenGL(), GL_LINE_LOOP, GL_LINE_SMOOTH, GL_LINE_SMOOTH_HINT, GL_NICEST, glBegin(), glColor3f(), glDisable(), glEnable(), glEnd(), glHint(), glLineWidth(), glVertex2fv(), m_Color, and m_RenderWindow.

{
  m_RenderWindow->MakeCurrent();
  
  Enable2DOpenGL();

  //make it nicer
  glEnable(GL_LINE_SMOOTH);
  glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
  
  //size and position
  int * i = m_RenderWindow->GetSize();
  GLfloat bbox[8] = {0.f , 0.f, (float)i[0], 0.f, (float)i[0], (float)i[1], 0.f, (float)i[1]};
    
  //render rectangle
  glLineWidth(5.0f);
  glBegin(GL_LINE_LOOP);
  for (int j = 0; j < 4; j++)
  {
    glColor3f(m_Color[0],m_Color[1],m_Color[2]);
    glVertex2fv(&bbox[2*j]);
  }
  glEnd();
  glLineWidth(1.0f);

  glDisable(GL_LINE_SMOOTH);

  Disable2DOpenGL();

  return 1;
}
int vtkMitkRectangleProp::RenderTranslucentGeometry ( vtkViewport *  viewport )

Definition at line 83 of file vtkMitkRectangleProp.cpp.

{
  return 0;
}
void vtkMitkRectangleProp::SetColor ( float  col1,
float  col2,
float  col3 
)

Definition at line 75 of file vtkMitkRectangleProp.cpp.

References m_Color.

Referenced by mitk::RenderWindowFrame::Enable().

{
  m_Color[0] = col1;
  m_Color[1] = col2;
  m_Color[2] = col3;
}
void vtkMitkRectangleProp::SetRenderWindow ( vtkRenderWindow *  renWin )

Definition at line 70 of file vtkMitkRectangleProp.cpp.

References m_RenderWindow.

Referenced by mitk::RenderWindowFrame::Enable().

{
  m_RenderWindow = renWin;
}
vtkMitkRectangleProp::vtkTypeMacro ( vtkMitkRectangleProp  ,
vtkProp   
)

Member Data Documentation

float vtkMitkRectangleProp::m_Color[3] [protected]

Definition at line 51 of file vtkMitkRectangleProp.h.

Referenced by RenderOverlay(), and SetColor().

vtkRenderWindow* vtkMitkRectangleProp::m_RenderWindow [protected]

Definition at line 50 of file vtkMitkRectangleProp.h.

Referenced by RenderOverlay(), and SetRenderWindow().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines