From 4e10e5809d9b08a70d18da4c04b2c9a8b93545ba Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 1 Dec 2005 15:49:56 +0000 Subject: [PATCH] Calculation of the "View to Display" coordinates transformation coefficient. --- src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 87ce9597..f4640aee 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -684,6 +684,21 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, if( this->UsePointSprites ) this->InitPointSprites(); + float p1[3], p2[3]; + + ren->SetViewPoint( 0.0, 0.0, 0.0 ); + ren->ViewToDisplay(); + ren->GetDisplayPoint( p1 ); + + ren->SetViewPoint( 1.0, 1.0, 1.0 ); + ren->ViewToDisplay(); + ren->GetDisplayPoint( p2 ); + + float coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 ); + //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl; + //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl; + //cout << "ZOOM : " << coefficient << endl; + glPointSize( this->DefaultPointSize ); vglUseProgramObjectARB( this->VertexProgram ); @@ -734,7 +749,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, else size = this->PointSpriteSize; - aVertex[i].hue = 1000.0 * this->AverageCellSize * this->PointSpriteMagnification * size; + aVertex[i].hue = coefficient * this->AverageCellSize * this->PointSpriteMagnification * size; } GLuint aBufferObjectID = 0; -- 2.39.2