#include "VISU_OpenGLPointSpriteMapper.hxx"
-#include "vtkCellArray.h"
-#include "vtkCellData.h"
-#include "vtkCommand.h"
-#include "vtkDataArray.h"
-#include "vtkFloatArray.h"
-#include "vtkMatrix4x4.h"
-#include "vtkObjectFactory.h"
-#include "vtkOpenGLRenderer.h"
-#include "vtkPlane.h"
-#include "vtkPlaneCollection.h"
-#include "vtkPointData.h"
-#include "vtkPolyData.h"
-#include "vtkPolygon.h"
-#include "vtkProperty.h"
-#include "vtkTimerLog.h"
-#include "vtkTriangle.h"
-#include "vtkOpenGLRenderWindow.h"
-#include "vtkOpenGLTexture.h"
-#include "vtkXMLImageDataReader.h"
-#include "vtkImageData.h"
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkCommand.h>
+#include <vtkDataArray.h>
+#include <vtkFloatArray.h>
+#include <vtkMatrix4x4.h>
+#include <vtkObjectFactory.h>
+#include <vtkOpenGLRenderer.h>
+#include <vtkPlane.h>
+#include <vtkPlaneCollection.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkPolygon.h>
+#include <vtkProperty.h>
+#include <vtkTimerLog.h>
+#include <vtkTriangle.h>
+#include <vtkOpenGLRenderWindow.h>
+#include <vtkOpenGLTexture.h>
+#include <vtkImageData.h>
#include <GL/glext.h>
//#include <GL/glx.h>
#include <vector>
#ifndef VTK_IMPLEMENT_MESA_CXX
-vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "$Revision$");
+vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$");
vtkStandardNewMacro(VISU_OpenGLPointSpriteMapper);
#endif
this->PointSpriteMaxSize = 50.0;
this->PointSpriteMagnification = 1.0;
- this->ImageData = 0;
- this->XMLImageDataReader = vtkXMLImageDataReader::New();
this->PointSpriteTexture = 0;
this->IsUsingOpenGLMapper = false;
}
delete [] this->SizeChannelArray;
this->SizeChannelArray = NULL;
}
- if (this->ImageData)
- {
- this->ImageData->Delete();
- this->ImageData = NULL;
- }
- if (this->XMLImageDataReader)
- {
- this->XMLImageDataReader->Delete();
- this->XMLImageDataReader = NULL;
- }
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
//glDisable( GL_VERTEX_PROGRAM_ARB );
}
+
+
//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::SetImageData( vtkImageData* theImageData )
+void
+VISU_OpenGLPointSpriteMapper
+::SetImageData( vtkImageData* theImageData )
{
- //cout << "VISU_OpenGLPointSpriteMapper::SetImageData " << this << " " << theImageData << endl;
- //theImageData->Print( cout );
-
this->ImageData = theImageData;
+}
- //cout << this->ImageData << endl;
+vtkImageData*
+VISU_OpenGLPointSpriteMapper
+::GetImageData()
+{
+ return this->ImageData.GetPointer();
}
+
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::InitTexture()
{
- //cout << "VISU_OpenGLPointSpriteMapper::InitTexture " << this << " " << this->ImageData << endl;
-
- //this->ImageData->Print( cout );
-
- unsigned char* dataPtr = (unsigned char*)this->ImageData->GetScalarPointer();
+ int* aSize = GetImageData()->GetDimensions();
+ unsigned char* dataPtr = (unsigned char*)GetImageData()->GetScalarPointer();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0,
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, aSize[0], aSize[1], 0,
GL_RGBA, GL_UNSIGNED_BYTE, dataPtr );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
vtkCellArray *cells,
vtkRenderer *ren)
{
- //this->XMLImageDataReader->SetFileName( "/dn06/salome/ouv/SALOME/TextureAlphaChannel.vti" );
- //vtkImageData* imageData = this->XMLImageDataReader->GetOutput();
-
- if( this->ImageData )
+ if( this->GetImageData() )
this->InitTexture();
this->InitSprites();