From: ouv Date: Fri, 18 Nov 2005 07:49:03 +0000 (+0000) Subject: Fixed bug GVIEW10592 : max sprite size (clamp parameter) X-Git-Tag: BR-D5-38-2003_D2005-24-11~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80852db36de71497996b0bc9bf0450e8f5ec3d83;p=modules%2Fvisu.git Fixed bug GVIEW10592 : max sprite size (clamp parameter) --- diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 7812f480..a56d3f4c 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -170,7 +170,7 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper() this->TotalCells = 0; this->ActorOpacity = 0; this->ExtensionsInitialized = 0; - this->DefaultPointSize = 50.0; + this->DefaultPointSize = 20.0; this->UsePointSprites = true; this->UseTextures = true; @@ -293,12 +293,6 @@ void VISU_OpenGLPointSpriteMapper::InitShader() cout << "Loading vertex program... failed" << endl << endl; */ free( shader ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0f, 0.0f, -4.0f ); - glRotatef( 0.0f, 1.0f, 0.0f, 0.0f ); - glRotatef( 0.0f, 0.0f, 1.0f, 0.0f ); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value ) @@ -387,7 +381,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) if( !this->ExtensionsInitialized && !this->UseOpenGLMapper ) { this->InitExtensions(); - act->GetProperty()->SetPointSize( 10.0f ); + act->GetProperty()->SetPointSize( 1.0f ); } if( this->UseOpenGLMapper ) @@ -512,7 +506,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) //----------------------------------------------------------------------------- float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize() { - float maximumSupportedSize = 300.0; + float maximumSupportedSize = 512.0; //glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maximumSupportedSize ); return maximumSupportedSize; @@ -563,7 +557,7 @@ void VISU_OpenGLPointSpriteMapper::InitPointSprites() //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::CleanupPointSprites() { - // Set GL params back to normal to stop other vtkMappers diusplaying wrongly + // Set GL params back to normal to stop other vtkMappers displaying wrongly glDisable( GL_ALPHA_TEST ); glEnable( GL_BLEND ); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index dd8b967e..ee2b10cb 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -116,7 +116,7 @@ public: virtual int Draw(vtkRenderer *ren, vtkActor *a); //! Return the maximum point size supported by the graphics hardware. - float GetMaximumSupportedSize(); + static float GetMaximumSupportedSize(); //! Set usage of #vtkOpenGLPolyDataMapper. /*! diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index cb16e78e..bbaff24b 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -33,6 +33,7 @@ #include "VISU_GaussPoints_i.hh" #include "VISU_GaussPointsPL.hxx" +#include "VISU_OpenGLPointSpriteMapper.hxx" #include "VISU_Convertor.hxx" #include "SalomeApp_Application.h" @@ -550,6 +551,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myClampSpinBox->setMaxValue( VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize() ); PrimitiveGroupLayout->addWidget( aClampLabel, 1, 0 ); PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); @@ -716,13 +718,10 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) myColorButton->setPaletteBackgroundColor( thePrs->GetColor() ); - myClampSpinBox->setMaxValue( thePrs->GetMaximumSupportedSize() ); myClampSpinBox->setValue( thePrs->GetClamp() ); - mySizeSpinBox->setValue( thePrs->GetConstSize() ); myMinSizeSpinBox->setValue( thePrs->GetMinSize() ); myMaxSizeSpinBox->setValue( thePrs->GetMaxSize() ); - myMagnificationSpinBox->setValue( thePrs->GetMagnification() ); myIncrementSpinBox->setValue( thePrs->GetMagnificationIncrement() ); diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 4e20b11b..d47df005 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -15,6 +15,7 @@ #include "VISU_ImplicitFunctionWidget.h" #include "VISU_GaussPointsPL.hxx" +#include "VISU_OpenGLPointSpriteMapper.hxx" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" @@ -204,6 +205,7 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c QLabel* ClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myClampSpinBox->setMaxValue( VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize() ); PrimitiveGroupLayout->addWidget( ClampLabel, 1, 0 ); PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); @@ -400,7 +402,7 @@ void VVTK_SegmentationCursorDlg::onColorButtonPressed() void VVTK_SegmentationCursorDlg::UpdateOutsideCursor() { - float aClamp = 200.0; + float aClamp = 256.0; QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; float anAlphaThreshold = 0.1;