From: isk Date: Wed, 17 Aug 2016 13:16:57 +0000 (+0300) Subject: Return old behavior of point sprites X-Git-Tag: V8_1_0rc1~8^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=973e3073fc9eadc66ec557e92ee0facc79beda78;p=modules%2Fgui.git Return old behavior of point sprites --- diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx index f61d2af21..3f08ccfbb 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx @@ -125,6 +125,7 @@ int VTKViewer_PolyDataMapper::InitShader() this->OpenGLHelper.vglUseProgramObjectARB( this->PointProgram ); this->myLocations.ModelViewProjection = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uModelViewProjectionMatrix" ); + this->myLocations.Projection = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uProjectionMatrix" ); this->myLocations.GeneralPointSize = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uGeneralPointSize" ); this->myLocations.PointSprite = this->OpenGLHelper.vglGetUniformLocationARB( this->PointProgram, "uPointSprite" ); @@ -883,6 +884,7 @@ void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) { { this->OpenGLHelper.SetUniformMatrix( this->myLocations.ModelViewProjection, wcdc ); } + this->OpenGLHelper.SetUniformMatrix( this->myLocations.Projection, vcdc ); this->OpenGLHelper.vglUniform1iARB( this->myLocations.GeneralPointSize, std::max( aSize[0], aSize[1] ) ); diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.h b/src/VTKViewer/VTKViewer_PolyDataMapper.h index 0413ae665..8fa5725b0 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.h +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.h @@ -141,11 +141,13 @@ private: static const GLint INVALID_LOCATION = -1; GLint ModelViewProjection; + GLint Projection; GLint GeneralPointSize; GLint PointSprite; Locations() : ModelViewProjection (INVALID_LOCATION), + Projection (INVALID_LOCATION), GeneralPointSize (INVALID_LOCATION), PointSprite (INVALID_LOCATION) { diff --git a/src/VTKViewer/resources/Point.fs.glsl b/src/VTKViewer/resources/Point.fs.glsl index 1c7cbb020..d13a97713 100644 --- a/src/VTKViewer/resources/Point.fs.glsl +++ b/src/VTKViewer/resources/Point.fs.glsl @@ -13,10 +13,9 @@ uniform sampler2D uPointSprite; in vec4 VSColor; void main() { - outColor = VSColor; - vec4 testColor = Texture2D(uPointSprite, gl_PointCoord); - if (testColor.r > 0.1) - outColor = testColor * outColor; - else + vec4 aColor = Texture2D(uPointSprite, gl_PointCoord) * VSColor; + if (aColor.a < 0.5) discard; + + outColor = aColor; } diff --git a/src/VTKViewer/resources/Point.vs.glsl b/src/VTKViewer/resources/Point.vs.glsl index c73f7eb18..50f109e63 100644 --- a/src/VTKViewer/resources/Point.vs.glsl +++ b/src/VTKViewer/resources/Point.vs.glsl @@ -9,6 +9,7 @@ attribute float Diameter; #endif +uniform mat4 uProjectionMatrix; uniform mat4 uModelViewProjectionMatrix; uniform int uGeneralPointSize; @@ -18,7 +19,7 @@ void main() gl_Position = uModelViewProjectionMatrix * vec4 (Vertex.xyz, 1.0); if (uGeneralPointSize == -1) - gl_PointSize = Diameter; + gl_PointSize = 1400 * uProjectionMatrix[1].y * Diameter; else gl_PointSize = uGeneralPointSize;