*/
#ifdef GL_ARB_shader_objects
-GLhandleARB VISU_OpenGLPointSpriteMapper::VertexProgram = 0;
+//GLhandleARB VISU_OpenGLPointSpriteMapper::VertexProgram = 0;
#endif
//cout << glGetAttribLocationARB( VISU_OpenGLPointSpriteMapper::VertexProgram, variable ) << " ";
//cout << variable << " " << value << endl;
- glVertexAttrib1fARB( glGetAttribLocationARB( VISU_OpenGLPointSpriteMapper::VertexProgram, variable ), value );
+ //glVertexAttrib1fARB( glGetAttribLocationARB( VISU_OpenGLPointSpriteMapper::VertexProgram, variable ), value );
+ glVertexAttrib1fARB( glGetAttribLocationARB( myVertexProgram, variable ), value );
}
#endif
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteResults( bool theResults )
{
+ float aResults = theResults ? 1.0 : 0.0;
+
+ //cout << "SetPointSpriteResults " << this << " " << aResults << endl;
+
this->PointSpriteResults = theResults;
#ifdef GL_ARB_shader_objects
- this->SetShaderVariable( "results", theResults );
+ this->SetShaderVariable( "results", aResults );
#endif
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp )
#ifdef GL_ARB_shader_objects
this->SetShaderVariable( "clamp", theClamp );
#endif
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize )
#ifdef GL_ARB_shader_objects
this->SetShaderVariable( "geomSize", theSize );
#endif
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize )
#ifdef GL_ARB_shader_objects
this->SetShaderVariable( "minSize", theMinSize );
#endif
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize )
#ifdef GL_ARB_shader_objects
this->SetShaderVariable( "maxSize", theMaxSize );
#endif
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnification )
#ifdef GL_ARB_shader_objects
this->SetShaderVariable( "magnification", theMagnification );
#endif
+ this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaThreshold )
+{
+ this->PointSpriteAlphaThreshold = theAlphaThreshold;
+ this->Modified();
}
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::InitExtensions()
//if( !VISU_OpenGLPointSpriteMapper::VertexProgram )
{
this->OpenGLLibrary = dlopen( "libGL.so", RTLD_LAZY );
- VISU_OpenGLPointSpriteMapper::VertexProgram = this->InitShader();
+ //VISU_OpenGLPointSpriteMapper::VertexProgram = this->InitShader();
+ myVertexProgram = this->InitShader();
}
- PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
- (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" );
- glUseProgramObjectARB( VISU_OpenGLPointSpriteMapper::VertexProgram );
+ //PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
+ // (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" );
+ //glUseProgramObjectARB( VISU_OpenGLPointSpriteMapper::VertexProgram );
this->SetShaderVariable( "attrib1", 1.0 );
this->SetShaderVariable( "attrib2", 1.0 );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
+ //cout << this << " THRESHOLD " << this->PointSpriteAlphaThreshold << endl;
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, this->PointSpriteAlphaThreshold );
break;
void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
{
// Set GL params back to normal to stop other vtkMappers diusplaying wrongly
+ glDisable( GL_ALPHA_TEST );
+
glEnable( GL_BLEND );
glEnable( GL_DEPTH_TEST );
glPointSize( this->DefaultPointSize );
#ifdef GL_ARB_vertex_buffer_object
+ PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
+ (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" );
PFNGLGENBUFFERSARBPROC glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)dlsym( this->OpenGLLibrary, "glGenBuffersARB" );
PFNGLBINDBUFFERARBPROC glBindBufferARB = (PFNGLBINDBUFFERARBPROC)dlsym( this->OpenGLLibrary, "glBindBufferARB" );
PFNGLBUFFERDATAARBPROC glBufferDataARB = (PFNGLBUFFERDATAARBPROC)dlsym( this->OpenGLLibrary, "glBufferDataARB" );
+ glUseProgramObjectARB( myVertexProgram );
+
TVertex* aVertex = new TVertex[ this->TotalCells ];
vtkIdType *pts = 0;
glDisableClientState(GL_VERTEX_ARRAY);
#endif
+ glUseProgramObjectARB( 0 );
+
if( this->UsePointSprites )
this->CleanupPointSprites();
}
// Point Sprite drawing mode
// (Results - multicolor, Geometry - fixed color)
vtkGetMacro(PointSpriteResults, bool);
+ void SetPointSpriteResults( bool );
// Description:
// Point Sprite size parameters
vtkGetMacro(PointSpriteMaxSize, float);
vtkGetMacro(PointSpriteMagnification, float);
- void SetPointSpriteResults( bool );
void SetPointSpriteClamp( float );
void SetPointSpriteSize( float );
void SetPointSpriteMinSize( float );
void SetPointSpriteMagnification( float );
vtkGetMacro(PointSpriteAlphaThreshold, float);
- vtkSetMacro(PointSpriteAlphaThreshold, float);
+ void SetPointSpriteAlphaThreshold( float );
void SetImageData(vtkImageData* theImageData);
vtkImageData* GetImageData();
static GLhandleARB VertexProgram;
void* OpenGLLibrary;
+ GLhandleARB myVertexProgram;
#endif
bool PointSpriteResults;