From: rnv Date: Tue, 6 Sep 2016 07:15:28 +0000 (+0300) Subject: Fix compilation error. X-Git-Tag: V8_1_0rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a4eb504819949139fc2332277d6d6af1d506beeb;p=modules%2Fgui.git Fix compilation error. --- diff --git a/src/VTKViewer/VTKViewer_OpenGLHelper.cxx b/src/VTKViewer/VTKViewer_OpenGLHelper.cxx index b92c14dc9..7be1e8b88 100644 --- a/src/VTKViewer/VTKViewer_OpenGLHelper.cxx +++ b/src/VTKViewer/VTKViewer_OpenGLHelper.cxx @@ -205,7 +205,7 @@ void VTKViewer_OpenGLHelper::Init() return; } -namespace +namespace GUI_OPENGL { char* readFromFile( std::string fileName ) { @@ -257,7 +257,7 @@ bool VTKViewer_OpenGLHelper::CreateShaderProgram (const std::string& theFilePath // Create vertex shader. fileName = theFilePath + ".vs.glsl"; - shaderContent = readFromFile (fileName); + shaderContent = GUI_OPENGL::readFromFile (fileName); theVertexShader = vglCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); vglShaderSourceARB (theVertexShader, 1, (const GLcharARB**)&shaderContent, NULL); @@ -281,7 +281,7 @@ bool VTKViewer_OpenGLHelper::CreateShaderProgram (const std::string& theFilePath // Create fragment shader. fileName = theFilePath + ".fs.glsl"; - shaderContent = readFromFile (fileName); + shaderContent = GUI_OPENGL::readFromFile (fileName); theFragmentShader = vglCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB); vglShaderSourceARB (theFragmentShader, 1, (const GLcharARB**)&shaderContent, NULL); @@ -349,6 +349,7 @@ void VTKViewer_OpenGLHelper::DestroyShaderProgram (GLhandleARB theProgram, // function : SetUniformMatrix // purpose : // ============================================================================ +#ifdef VTK_OPENGL2 void VTKViewer_OpenGLHelper::SetUniformMatrix (const GLint theLocation, const vtkMatrix4x4* theMatrix) const { @@ -360,3 +361,4 @@ void VTKViewer_OpenGLHelper::SetUniformMatrix (const GLint theLocation, this->vglUniformMatrix4fvARB (theLocation, 1, GL_FALSE, data); } +#endif diff --git a/src/VTKViewer/VTKViewer_OpenGLHelper.h b/src/VTKViewer/VTKViewer_OpenGLHelper.h index 26333be2d..3a6c9d434 100644 --- a/src/VTKViewer/VTKViewer_OpenGLHelper.h +++ b/src/VTKViewer/VTKViewer_OpenGLHelper.h @@ -66,6 +66,11 @@ typedef ptrdiff_t GLsizeiptrARB; #define GL_STATIC_DRAW_ARB 0x88E4 #endif + +namespace GUI_OPENGL { +char* readFromFile( std::string fileName ); +} + class VTKVIEWER_EXPORT VTKViewer_OpenGLHelper { public: @@ -85,9 +90,10 @@ public: void DestroyShaderProgram (GLhandleARB theProgram, GLhandleARB theVertexShader, GLhandleARB theFragmentShader) const; - +#ifdef VTK_OPENGL2 void SetUniformMatrix (const GLint theLocation, const vtkMatrix4x4* theMatrix) const; +#endif protected: typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx index 3f08ccfbb..35dedc6fb 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx @@ -136,7 +136,7 @@ int VTKViewer_PolyDataMapper::InitShader() std::string fileName = std::string( getenv( "GUI_ROOT_DIR") ) + "/share/salome/resources/gui/Vertex_Program_ARB.txt"; - char* shader = readFromFile( fileName ); + char* shader = GUI_OPENGL::readFromFile( fileName ); GLhandleARB VertexShader = this->OpenGLHelper.vglCreateShaderObjectARB( GL_VERTEX_SHADER_ARB ); this->OpenGLHelper.vglShaderSourceARB( VertexShader, 1, (const GLcharARB**)&shader, NULL ); @@ -974,7 +974,7 @@ void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) { this->OpenGLHelper.vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); this->OpenGLHelper.vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aDiamsID ); - attribute_diams = vglGetAttribLocationARB(this->PointProgram, "diameter"); + attribute_diams = this->OpenGLHelper.vglGetAttribLocationARB(this->PointProgram, "diameter"); this->OpenGLHelper.vglEnableVertexAttribArrayARB(attribute_diams); this->OpenGLHelper.vglBindBufferARB(GL_ARRAY_BUFFER_ARB, aDiamsID); this->OpenGLHelper.vglVertexAttribPointerARB(