Commit 07f0348a authored by François Bertel's avatar François Bertel Committed by David Partyka
Browse files

BUG:Fixed wrong use of OpenGLExtensionManager in vtkOpenGLVolumeTextureMapper3D

Warning: It required a API change for the signature of IsRenderSupported().
parent d5afc516
......@@ -85,7 +85,7 @@ volumeMapper_1_3 SetCroppingRegionFlags 67117057
set culler [[ren1 GetCullers] GetNextItem]
$culler SetSortingStyleToBackToFront
set valid [volumeMapper_0_0 IsRenderSupported volumeProperty]
set valid [volumeMapper_0_0 IsRenderSupported volumeProperty ren1]
if {!$valid} {
ren1 RemoveAllViewProps
......
......@@ -84,7 +84,7 @@ volumeMapper_1_3 SetCroppingRegionFlags 67117057
set culler [[ren1 GetCullers] GetNextItem]
$culler SetSortingStyleToBackToFront
set valid [volumeMapper_0_0 IsRenderSupported volumeProperty]
set valid [volumeMapper_0_0 IsRenderSupported volumeProperty ren1]
if {!$valid} {
ren1 RemoveAllViewProps
......
......@@ -124,7 +124,7 @@ renWin Render
[ren1 GetActiveCamera] Roll 45
[ren1 GetActiveCamera] Zoom 2.0
set valid [volumeMapper IsRenderSupported volumeProperty]
set valid [volumeMapper IsRenderSupported volumeProperty ren1]
ren1 AddViewProp volume
if {!$valid} {
......
......@@ -32,6 +32,7 @@
#include "vtkMath.h"
#include "vtkOpenGLExtensionManager.h"
#include "vtkgl.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkVolumeTextureMapper3D_OneComponentShadeFP.h"
#include "vtkVolumeTextureMapper3D_OneComponentNoShadeFP.h"
......@@ -94,7 +95,7 @@ void vtkOpenGLVolumeTextureMapper3D::Render(vtkRenderer *ren, vtkVolume *vol)
if ( !this->Initialized )
{
this->Initialize();
this->Initialize(ren);
}
if ( this->RenderMethod == vtkVolumeTextureMapper3D::NO_METHOD )
......@@ -1731,11 +1732,12 @@ void vtkOpenGLVolumeTextureMapper3D::SetupProgramLocalsForShadingFP(
}
int vtkOpenGLVolumeTextureMapper3D::IsRenderSupported(
vtkVolumeProperty *property )
vtkVolumeProperty *property,
vtkRenderer *r)
{
if ( !this->Initialized )
{
this->Initialize();
this->Initialize(r);
}
if ( this->RenderMethod == vtkVolumeTextureMapper3D::NO_METHOD )
......@@ -1757,11 +1759,11 @@ int vtkOpenGLVolumeTextureMapper3D::IsRenderSupported(
return 1;
}
void vtkOpenGLVolumeTextureMapper3D::Initialize()
void vtkOpenGLVolumeTextureMapper3D::Initialize(vtkRenderer *r)
{
this->Initialized = 1;
vtkOpenGLExtensionManager * extensions = vtkOpenGLExtensionManager::New();
extensions->SetRenderWindow(NULL); // set render window to the current one.
vtkOpenGLExtensionManager *extensions=static_cast<vtkOpenGLRenderWindow *>(
r->GetRenderWindow())->GetExtensionManager();
int supports_texture3D=extensions->ExtensionSupported( "GL_VERSION_1_2" );
if(supports_texture3D)
......@@ -1889,9 +1891,6 @@ void vtkOpenGLVolumeTextureMapper3D::Initialize()
{
extensions->LoadExtension( "GL_NV_register_combiners" );
}
extensions->Delete();
int canDoFP = 0;
int canDoNV = 0;
......@@ -2023,41 +2022,44 @@ int vtkOpenGLVolumeTextureMapper3D::IsTextureSizeSupported(int size[3],
// Print the vtkOpenGLVolumeTextureMapper3D
void vtkOpenGLVolumeTextureMapper3D::PrintSelf(ostream& os, vtkIndent indent)
{
vtkOpenGLExtensionManager * extensions = vtkOpenGLExtensionManager::New();
extensions->SetRenderWindow(NULL); // set render window to current render window
os << indent << "Initialized " << this->Initialized << endl;
if ( this->Initialized )
{
os << indent << "Supports GL_VERSION_1_2:"
<< extensions->ExtensionSupported( "GL_VERSION_1_2" ) << endl;
os << indent << "Supports GL_EXT_texture3D:"
<< extensions->ExtensionSupported( "GL_EXT_texture3D" ) << endl;
os << indent << "Supports GL_VERSION_1_3:"
<< extensions->ExtensionSupported( "GL_VERSION_1_3" ) << endl;
os << indent << "Supports GL_ARB_multitexture: "
<< extensions->ExtensionSupported( "GL_ARB_multitexture" ) << endl;
os << indent << "Supports GL_NV_texture_shader2: "
<< extensions->ExtensionSupported( "GL_NV_texture_shader2" ) << endl;
os << indent << "Supports GL_NV_register_combiners2: "
<< extensions->ExtensionSupported( "GL_NV_register_combiners2" )
<< endl;
os << indent << "Supports GL_ATI_fragment_shader: "
<< extensions->ExtensionSupported( "GL_ATI_fragment_shader" ) << endl;
os << indent << "Supports GL_ARB_fragment_program: "
<< extensions->ExtensionSupported( "GL_ARB_fragment_program" ) << endl;
os << indent << "Supports GL_ARB_texture_compression: "
<< extensions->ExtensionSupported( "GL_ARB_texture_compression" )
<< endl;
os << indent << "Supports GL_VERSION_2_0:"
<< extensions->ExtensionSupported( "GL_VERSION_2_0" )
<< endl;
os << indent << "Supports GL_ARB_texture_non_power_of_two:"
<< extensions->ExtensionSupported( "GL_ARB_texture_non_power_of_two" )
<< endl;
}
extensions->Delete();
if(this->RenderWindow!=0)
{
vtkOpenGLExtensionManager *extensions=
static_cast<vtkOpenGLRenderWindow *>(this->RenderWindow)
->GetExtensionManager();
if ( this->Initialized )
{
os << indent << "Supports GL_VERSION_1_2:"
<< extensions->ExtensionSupported( "GL_VERSION_1_2" ) << endl;
os << indent << "Supports GL_EXT_texture3D:"
<< extensions->ExtensionSupported( "GL_EXT_texture3D" ) << endl;
os << indent << "Supports GL_VERSION_1_3:"
<< extensions->ExtensionSupported( "GL_VERSION_1_3" ) << endl;
os << indent << "Supports GL_ARB_multitexture: "
<< extensions->ExtensionSupported( "GL_ARB_multitexture" ) << endl;
os << indent << "Supports GL_NV_texture_shader2: "
<< extensions->ExtensionSupported( "GL_NV_texture_shader2" ) << endl;
os << indent << "Supports GL_NV_register_combiners2: "
<< extensions->ExtensionSupported( "GL_NV_register_combiners2" )
<< endl;
os << indent << "Supports GL_ATI_fragment_shader: "
<< extensions->ExtensionSupported( "GL_ATI_fragment_shader" ) << endl;
os << indent << "Supports GL_ARB_fragment_program: "
<< extensions->ExtensionSupported( "GL_ARB_fragment_program" )
<< endl;
os << indent << "Supports GL_ARB_texture_compression: "
<< extensions->ExtensionSupported( "GL_ARB_texture_compression" )
<< endl;
os << indent << "Supports GL_VERSION_2_0:"
<< extensions->ExtensionSupported( "GL_VERSION_2_0" )
<< endl;
os << indent << "Supports GL_ARB_texture_non_power_of_two:"
<< extensions->ExtensionSupported( "GL_ARB_texture_non_power_of_two" )
<< endl;
}
}
this->Superclass::PrintSelf(os,indent);
}
......
......@@ -46,7 +46,8 @@ public:
// Is hardware rendering supported? No if the input data is
// more than one independent component, or if the hardware does
// not support the required extensions
int IsRenderSupported(vtkVolumeProperty *);
int IsRenderSupported(vtkVolumeProperty *,
vtkRenderer *ren);
//BTX
......@@ -103,7 +104,7 @@ protected:
int InternalRGB; // GLint
int InternalRGBA; // GLint
void Initialize();
void Initialize(vtkRenderer *r);
virtual void RenderNV(vtkRenderer *ren, vtkVolume *vol);
virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol);
......
......@@ -109,7 +109,9 @@ public:
// render using 3D texture mapping. This indicates if 3D texture
// mapping is supported by the hardware, and if the other extensions
// necessary to support the specific properties are available.
virtual int IsRenderSupported( vtkVolumeProperty * ) {return 0;};
virtual int IsRenderSupported( vtkVolumeProperty *,
vtkRenderer *vtkNotUsed(r))
{return 0;}
// Description:
// Allow access to the number of polygons used for the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment