00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $ 00006 Version: $Revision: 17179 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 00020 #include "mitkCompositeMapper.h" 00021 00022 00023 mitk::CompositeMapper::CompositeMapper() 00024 { 00025 m_OdfMapper = mitk::OdfVtkMapper2D<float,QBALL_ODFSIZE>::New(); 00026 m_ImgMapper = mitk::CopyImageMapper2D::New(); 00027 } 00028 00029 mitk::CompositeMapper::~CompositeMapper() 00030 { 00031 } 00032 00033 void mitk::CompositeMapper::Enable2DOpenGL() 00034 { 00035 GLint iViewport[4]; 00036 00037 // Get a copy of the viewport 00038 glGetIntegerv( GL_VIEWPORT, iViewport ); 00039 00040 // Save a copy of the projection matrix so that we can restore it 00041 // when it's time to do 3D rendering again. 00042 glMatrixMode( GL_PROJECTION ); 00043 glPushMatrix(); 00044 glLoadIdentity(); 00045 00046 // Set up the orthographic projection 00047 glOrtho( 00048 iViewport[0], iViewport[0]+iViewport[2], 00049 iViewport[1], iViewport[1]+iViewport[3], 00050 -1.0, 1.0 00051 ); 00052 glMatrixMode( GL_MODELVIEW ); 00053 glPushMatrix(); 00054 glLoadIdentity(); 00055 00056 // Make sure depth testing and lighting are disabled for 2D rendering until 00057 // we are finished rendering in 2D 00058 glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT ); 00059 glDisable( GL_DEPTH_TEST ); 00060 glDisable( GL_LIGHTING ); 00061 } 00062 00063 void mitk::CompositeMapper::Disable2DOpenGL() 00064 { 00065 glPopAttrib(); 00066 glMatrixMode( GL_PROJECTION ); 00067 glPopMatrix(); 00068 glMatrixMode( GL_MODELVIEW ); 00069 glPopMatrix(); 00070 }