<div dir="ltr">Thanks for the update. ParaView and VTK converts those files into compilation unit and that's why you don't have it. I guess in <div>order to debug this, you would have to build the ParaView. We cannot reproduce the issue on NVIDIA cards (GLSL 420 as well). </div>
<div><br></div><div>- Aashish</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 10, 2014 at 1:37 PM, Bruce Jones <span dir="ltr"><<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Aashish,<div><br></div><div>There are no *.glsl files in my paraview folder...</div><div><br></div><div>
Cheers,</div><div>Bruce</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 10, 2014 at 12:58 PM, Aashish Chaudhary <span dir="ltr"><<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">John, <div><br></div><div>Having another shader active should not be a problem. Since for shader we should be calling Use() before we start using it. My suspect is the shader version because of the various warning. </div>


<div><br></div><div><font size="4">@Bruce, don't compile again. Just look for shader files *.glsl (for eg. Texture_vs.glsl)  and add version info on the top (first line). See if that gets into effect. </font></div><span><font color="#888888"><div>


<br></div><div>- Aashish</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 10, 2014 at 12:53 PM, Bruce Jones <span dir="ltr"><<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey <span style="font-family:arial,sans-serif;font-size:13px">Aashish,</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br>


</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I am using the Paraview binaries, and havent compiled paraview on windows before. So this may take me a little while to set up, will get back to you when I've figured it out. I'm happy to run anything you build your end if that works.</span></div>



<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">Thanks for the suggestion John. I get the same errors with depth peeling deactivated. All the settings I am using are default, other than the pointsprite plugin.</font></div>



<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Cheers,</font></div><div><font face="arial, sans-serif">Bruce</font></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">
On Mon, Feb 10, 2014 at 12:47 PM, Biddiscombe, John A. <span dir="ltr"><<a href="mailto:biddisco@cscs.ch" target="_blank">biddisco@cscs.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



NB. Before testing lots of other stuff … Make sure you disable depth peeling the main paraview options. The point sprite shader stuff will never work if there’s another shader active.<br>
<br>
From: Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>><br>



Date: Monday 10 February 2014 18:45<br>
To: Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>><br>



Cc: "<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><mailto:<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>>" <<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><mailto:<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>>><br>




Subject: Re: [Paraview] PointSprite with Recent Intel HD Graphics<br>
<div><br>
Sorry, I hit send by mistake,<br>
<br>
In this directory,<br>
<br>
PARAVIEW_SRC/Plugins/PointSprite/Rendering/Resources/Shaders<br>
<br>
Can you add line below at the beginning of all of the shaders.  You may have to compile ParaView (or plugin again).  This may not fix the problem but it would be great if you can provide some<br>
feedback after this.<br>
<br>
- Aashish<br>
<br>
<br>
 #version 150<br>
<br>
<br>
<br>
</div><div>On Mon, Feb 10, 2014 at 12:43 PM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




Bruce,<br>
<br>
In the<br>
<br>
<br>
<br>
</div><div>On Mon, Feb 10, 2014 at 12:08 PM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




This is very helpful. I am speculating that it could be related to the default shader version on your system (yours is shader model 5 I believe).<br>
<br>
Let me come up with a quick fix (unless somone else beats me to it) which you can try. I will send that in a separate email.<br>
<br>
- Aashish<br>
<br>
<br>
<br>
</div><div><div>On Mon, Feb 10, 2014 at 11:57 AM, Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>> wrote:<br>




Hi Aashish,<br>
<br>
Thanks for getting back to me, I'll have a look at the breakpoint this afternoon. In the mean time, the full error logs are below, which appear to show the shader source for the failed shader.<br>
<br>
Using PointSprite with Sphere(Texture) and a constant radius works fine.<br>
<br>
Using PointSprite with Sphere(Texture) and a variable radius fails with the following message,<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 530<br>
<br>
vtkShaderProgram2 (0000000012D40520): the shader program failed to link. Its log is:<br>
<br>
the shaders are:<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #0/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: AttributeRadiusHelper.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME AttributeRadiusHelper.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
uniform vec2 RadiusSpan;<br>
<br>
attribute float Radius;<br>
<br>
<br>
float GetRadius()<br>
<br>
{<br>
<br>
return RadiusSpan.x + Radius*RadiusSpan.y;<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #1/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: Texture_vs.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME Texture_vs.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
uniform float MaxPixelSize;<br>
<br>
uniform vec2 viewport;<br>
<br>
<br>
float GetRadius();<br>
<br>
<br>
void propFuncVS()<br>
<br>
{<br>
<br>
float radius = GetRadius();<br>
<br>
<br>
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;<br>
<br>
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;<br>
<br>
//<br>
<br>
// Convert position to window coordinates<br>
<br>
//<br>
<br>
<br>
//<br>
<br>
// Convert Radius to window coordinates<br>
<br>
// radius/w is homogenous clip coord<br>
<br>
//<br>
<br>
float pixelSize = (radius/gl_Position.w)*(4.0*viewport.y);<br>
<br>
<br>
// Clamp radius to prevent overloading if bad scalars were passed in<br>
<br>
if (pixelSize>MaxPixelSize)<br>
<br>
pixelSize = MaxPixelSize;<br>
<br>
<br>
gl_PointSize = pixelSize;<br>
<br>
gl_FrontColor = gl_Color;<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #2/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
// ============================================================================<br>
<br>
//<br>
<br>
// Program: Visualization Toolkit<br>
<br>
// Module: vtkOpenGLPropertyDefaultMain_vs.glsl<br>
<br>
//<br>
<br>
// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
// All rights reserved.<br>
<br>
// See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
//<br>
<br>
// This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
// PURPOSE. See the above copyright notice for more information.<br>
<br>
//<br>
<br>
// ============================================================================<br>
<br>
<br>
// This is the default vertex shader with the main() function. It is used when<br>
<br>
// no main() is provided at the renderer level and some vertex shader is<br>
<br>
// defined by the user on a property.<br>
<br>
<br>
#version 110<br>
<br>
<br>
void propFuncVS();<br>
<br>
<br>
void main()<br>
<br>
{<br>
<br>
propFuncVS();<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkOpenGLProperty.cxx, line 415<br>
<br>
vtkPointSpriteProperty (000000001118DD20): Couldn't build the shader program. At this point , it can be an error in a shader or a driver bug.<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 530<br>
<br>
vtkShaderProgram2 (0000000012D40520): the shader program failed to link. Its log is:<br>
<br>
the shaders are:<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #0/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: AttributeRadiusHelper.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME AttributeRadiusHelper.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
uniform vec2 RadiusSpan;<br>
<br>
attribute float Radius;<br>
<br>
<br>
float GetRadius()<br>
<br>
{<br>
<br>
return RadiusSpan.x + Radius*RadiusSpan.y;<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #1/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: Texture_vs.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME Texture_vs.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
uniform float MaxPixelSize;<br>
<br>
uniform vec2 viewport;<br>
<br>
<br>
float GetRadius();<br>
<br>
<br>
void propFuncVS()<br>
<br>
{<br>
<br>
float radius = GetRadius();<br>
<br>
<br>
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;<br>
<br>
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;<br>
<br>
//<br>
<br>
// Convert position to window coordinates<br>
<br>
//<br>
<br>
<br>
//<br>
<br>
// Convert Radius to window coordinates<br>
<br>
// radius/w is homogenous clip coord<br>
<br>
//<br>
<br>
float pixelSize = (radius/gl_Position.w)*(4.0*viewport.y);<br>
<br>
<br>
// Clamp radius to prevent overloading if bad scalars were passed in<br>
<br>
if (pixelSize>MaxPixelSize)<br>
<br>
pixelSize = MaxPixelSize;<br>
<br>
<br>
gl_PointSize = pixelSize;<br>
<br>
gl_FrontColor = gl_Color;<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 540<br>
<br>
vtkShaderProgram2 (0000000012D40520): shader #2/3 (vertex shader) log is:<br>
<br>
<br>
. Its source code is:<br>
<br>
// ============================================================================<br>
<br>
//<br>
<br>
// Program: Visualization Toolkit<br>
<br>
// Module: vtkOpenGLPropertyDefaultMain_vs.glsl<br>
<br>
//<br>
<br>
// Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
// All rights reserved.<br>
<br>
// See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
//<br>
<br>
// This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
// PURPOSE. See the above copyright notice for more information.<br>
<br>
//<br>
<br>
// ============================================================================<br>
<br>
<br>
// This is the default vertex shader with the main() function. It is used when<br>
<br>
// no main() is provided at the renderer level and some vertex shader is<br>
<br>
// defined by the user on a property.<br>
<br>
<br>
#version 110<br>
<br>
<br>
void propFuncVS();<br>
<br>
<br>
void main()<br>
<br>
{<br>
<br>
propFuncVS();<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkOpenGLProperty.cxx, line 415<br>
<br>
vtkPointSpriteProperty (000000001118DD20): Couldn't build the shader program. At this point , it can be an error in a shader or a driver bug.<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 1084<br>
<br>
vtkShaderProgram2 (0000000012D40520): glGetAttribLocation 1 OpenGL errors detected<br>
<br>
0 : (1281) Invalid value<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 1084<br>
<br>
vtkShaderProgram2 (0000000012D40520): glGetAttribLocation 1 OpenGL errors detected<br>
<br>
0 : (1281) Invalid value<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 1084<br>
<br>
vtkShaderProgram2 (0000000012D40520): glGetAttribLocation 1 OpenGL errors detected<br>
<br>
0 : (1281) Invalid value<br>
<br>
<br>
Using PointSprite with Sphere and a constant radius fails with the following message,<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 481<br>
<br>
vtkShaderProgram2 (0000000012D40520): a shader failed to compile. Its log is:<br>
<br>
WARNING: 0:89: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:143: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:159: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:196: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:207: 'assign' : implicit type conversion allowed from GLSL 1.20<br>
<br>
ERROR: 0:207: '=' : cannot convert from 'const int' to '3-component vector of float'<br>
<br>
ERROR: 0:216: 'assign' : cannot convert from '4-component vector of float' to '3-component vector of float'<br>
<br>
ERROR: 0:217: 'N' : undeclared identifier<br>
<br>
ERROR: 0:217: 'assign' : cannot convert from '3-component vector of float' to 'float'<br>
<br>
ERROR: 0:218: 'dot' : no matching overloaded function found (using implicit conversion)<br>
<br>
ERROR: 0:218: 'assign' : l-value required "d" (can't modify a varying)<br>
<br>
ERROR: 0:219: 'viewdir' : undeclared identifier<br>
<br>
ERROR: 0:219: 'assign' : cannot convert from '3-component vector of float' to 'float'<br>
<br>
ERROR: 0:220: 'vl' : undeclared identifier<br>
<br>
ERROR: 0:220: 'reflect' : no matching overloaded function found (using implicit conversion)<br>
<br>
ERROR: 0:221: 's' : undeclared identifier<br>
<br>
ERROR: 0:222: 'assign' : cannot convert from '4-component vector of float' to '3-component vector of float'<br>
<br>
WARNING: 0:251: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: Quadrics_fs.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME Quadrics_fs.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
//<br>
<br>
// IN:<br>
<br>
// - vertex position<br>
<br>
// - point size<br>
<br>
// - ray origin<br>
<br>
// - perspective flag<br>
<br>
// - quadric equation coefficients<br>
<br>
// - color<br>
<br>
// - viewport (width and height only)<br>
<br>
// - min point size (pointThreshold)<br>
<br>
//<br>
<br>
// OUT:<br>
<br>
// - fragment color computed from point intersected by ray shot from<br>
<br>
// viewpoint through point computed from current fragment coordinate<br>
<br>
// - fragment depth computed by projecting the intersection point into screen<br>
<br>
// coordinates<br>
<br>
<br>
<br>
// OPTIMAL<br>
<br>
#define ELLIPSOID<br>
<br>
//#define CYLINDER<br>
<br>
//#define CONE<br>
<br>
//#define HYPERBOLOID1<br>
<br>
//#define HYPERBOLOID2<br>
<br>
//#define PARABOLOID<br>
<br>
<br>
// SUB OPTIMAL<br>
<br>
//#define HYPER_PARABOLOID<br>
<br>
<br>
uniform vec2 viewport; // only width and height passed, no origin<br>
<br>
uniform float pointSizeThreshold; // minimum point size<br>
<br>
<br>
varying vec4 color;<br>
<br>
varying float a;<br>
<br>
varying float b;<br>
<br>
varying float c;<br>
<br>
varying float d;<br>
<br>
varying float e;<br>
<br>
varying float f;<br>
<br>
varying float g;<br>
<br>
varying float h;<br>
<br>
varying float i;<br>
<br>
varying float j;<br>
<br>
varying float pointSize;<br>
<br>
varying float perspective;<br>
<br>
<br>
vec3 raydir; // ray direction in screen space<br>
<br>
vec3 rayorigin; // ray origin in screen space<br>
<br>
<br>
#ifndef ELLIPSOID<br>
<br>
varying mat4 Ti;<br>
<br>
#endif<br>
<br>
<br>
const float FLAT_SHADE_POINT_SIZE = 1.0; //if point size < 1 use flat shading<br>
<br>
<br>
const float FEPS = 0.0001;<br>
<br>
<br>
const float BOUND = 1.0 + FEPS;<br>
<br>
<br>
const vec3 MIN_BOUND = vec3(-BOUND);<br>
<br>
<br>
const vec3 MAX_BOUND = vec3(BOUND);<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// BOUNDS CHECK<br>
<br>
// in general it makes sense to check only along the z direction for:<br>
<br>
// - paraboloids<br>
<br>
// - hyperboloids of one sheet<br>
<br>
// - cylinders<br>
<br>
// - cones<br>
<br>
// and no checking at all is required for ellipsoids<br>
<br>
#ifndef ELLIPSOID<br>
<br>
bool InBounds( vec3 P )<br>
<br>
{<br>
<br>
vec4 v = Ti * gl_ModelViewMatrixInverse * vec4( P, 1. );<br>
<br>
#if defined( CYLINDER ) || defined( CONE ) || defined( HYPERBOLOID1 ) || defined( PARABOLOID )<br>
<br>
return v.z >= -BOUND && v.z <= BOUND;<br>
<br>
#else<br>
<br>
return all( greaterThanEqual( v.xyz, MIN_BOUND ) ) &&<br>
<br>
all( lessThanEqual( v.xyz, MAX_BOUND ) );<br>
<br>
#endif<br>
<br>
}<br>
<br>
#endif<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// INTERSECTION<br>
<br>
struct I<br>
<br>
{<br>
<br>
vec3 P;<br>
<br>
vec3 N;<br>
<br>
float t;<br>
<br>
};<br>
<br>
<br>
// compute unit normal from gradient<br>
<br>
vec3 ComputeNormal(vec3 P)<br>
<br>
{<br>
<br>
return normalize(vec3(dot(vec4(a, d, e, 1.), vec4(P, g)), // should multiply by 2 for actual gradient<br>
<br>
dot(vec4(d, b, f, 1.), vec4(P, h)), // should multiply by 2 for actual gradient<br>
<br>
dot(vec4(e, f, c, 1.), vec4(P, i)) // should multiply by 2 for actual gradient<br>
<br>
));<br>
<br>
}<br>
<br>
<br>
// compute ray quadric intersection; if no intersection occurs I.t is < 0<br>
<br>
// main axis length and orientation are used to clip the quadric; not<br>
<br>
// required for closed quadrics (ellipsoids)<br>
<br>
// | a d e g |<br>
<br>
// | d b f h |<br>
<br>
// | e f c i |<br>
<br>
// | g h i j |<br>
<br>
// ax^2 + by^2 + cz^2 + 2dxy +2exz + 2fyz + 2gx + 2hy + 2iz + j = 0<br>
<br>
/// @todo pass vec3(a, b, c), vec3( d, e, f ) and vec3( g, h, i ) instead of single coefficients<br>
<br>
I ComputeRayQuadricIntersection()<br>
<br>
{<br>
<br>
I ip;<br>
<br>
ip.t = -1.0;<br>
<br>
vec3 P = rayorigin;<br>
<br>
vec3 D = raydir;<br>
<br>
float A = 0.0;<br>
<br>
float B = 0.0;<br>
<br>
float C = 0.0;<br>
<br>
if (bool(perspective))<br>
<br>
{<br>
<br>
A = dot(vec3(a, b, c), D * D) + 2. * dot(vec3(d, e, f), D.xxy * D.yzz);<br>
<br>
B = 2. * dot(vec3(g, h, i), D);<br>
<br>
C = j;<br>
<br>
}<br>
<br>
else<br>
<br>
{<br>
<br>
A = c;<br>
<br>
//B = -2. * dot( vec4( c, e, f, 1. ), vec4( P.zxy, 1. ) );<br>
<br>
B = -2. * dot(vec4(d, e, f, i), vec4(P.zxy, 1.));<br>
<br>
C = dot(vec3(a, b, c), P * P) + 2. * (dot(vec3(d, e, f), P.xxy * P.yzz)<br>
<br>
+ dot(vec3(g, h, i), P)) + j;<br>
<br>
}<br>
<br>
float delta = B * B - 4. * A * C;<br>
<br>
if (delta < 0.0)<br>
<br>
return ip;<br>
<br>
float d = sqrt(delta);<br>
<br>
A = 1. / A;<br>
<br>
A *= 0.5;<br>
<br>
float t2 = A * (-B + d);<br>
<br>
float t1 = A * (-B - d);<br>
<br>
#ifdef ELLIPSOID<br>
<br>
ip.P = rayorigin + D * min(t1, t2);<br>
<br>
ip.N = ComputeNormal(ip.P);<br>
<br>
ip.t = 0.;<br>
<br>
#else<br>
<br>
vec3 P1 = rayorigin + D * min( t1, t2 );<br>
<br>
vec3 P2 = rayorigin + D * max( t1, t2 );<br>
<br>
if( InBounds( P1 ) )<br>
<br>
{<br>
<br>
ip.P = P1;<br>
<br>
ip.N = ComputeNormal( P1 );<br>
<br>
ip.t = 0.;<br>
<br>
}<br>
<br>
else if( InBounds( P2 ) )<br>
<br>
{<br>
<br>
ip.P = P2;<br>
<br>
ip.N = ComputeNormal( P2 );<br>
<br>
ip.t = 0.;<br>
<br>
}<br>
<br>
#endif<br>
<br>
return ip;<br>
<br>
}<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// LIGHTING, standard phong lighting model<br>
<br>
vec3 lightDir = normalize(vec3(0.1, 0.1, 1.));<br>
<br>
float kd = 1.0;<br>
<br>
float ka = 0.01;<br>
<br>
float ks = .5;<br>
<br>
float sh = 90.0;<br>
<br>
vec4 refcolor = vec4(1., 1., 1., 1.);<br>
<br>
vec4 ComputeColor(vec4 color, vec3 n, vec3 P)<br>
<br>
{<br>
<br>
if (pointSize < FLAT_SHADE_POINT_SIZE)<br>
<br>
return color;<br>
<br>
<br>
vec3 col = (0, 0, 0);<br>
<br>
vec3 N;<br>
<br>
float d;<br>
<br>
vec3 viewdir;<br>
<br>
float vl;<br>
<br>
float s;<br>
<br>
<br>
for (int li = 0; li < 4; li++)<br>
<br>
{<br>
<br>
lightDir = normalize(gl_LightSource[li].position);<br>
<br>
N = faceforward(-n, lightDir, n);<br>
<br>
d = dot(N, lightDir);<br>
<br>
viewdir = normalize(-P);<br>
<br>
vl = max(0., dot(reflect(-lightDir, N), viewdir));<br>
<br>
s = pow(vl, gl_FrontMaterial.shininess);<br>
<br>
col += gl_FrontMaterial.specular * s * gl_LightSource[li].specular.rgb + kd<br>
<br>
* d * color.rgb * gl_LightSource[li].diffuse.rgb + ka * color.rgb<br>
<br>
* gl_LightSource[li].ambient.rgb;<br>
<br>
}<br>
<br>
<br>
return vec4(col, color.a);<br>
<br>
<br>
}<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// MAIN<br>
<br>
void propFuncFS(void)<br>
<br>
{<br>
<br>
if (pointSize < pointSizeThreshold || color.a <= 0.0)<br>
<br>
discard;<br>
<br>
vec3 fc = gl_FragCoord.xyz;<br>
<br>
fc.xy /= viewport;<br>
<br>
fc *= 2.0;<br>
<br>
fc -= 1.0;<br>
<br>
vec4 p = gl_ProjectionMatrixInverse * vec4(fc, 1.);<br>
<br>
if (bool(perspective))<br>
<br>
{<br>
<br>
// in perspective mode, rayorigin is always at (0, 0, 0)<br>
<br>
rayorigin = vec3(0., 0., 0.);<br>
<br>
raydir = vec3(p) / p.w;<br>
<br>
}<br>
<br>
else<br>
<br>
{<br>
<br>
// in orthographic mode, raydir is always ( 0., 0., -1. );<br>
<br>
raydir = vec3(0., 0., -1.);<br>
<br>
rayorigin = vec3(p.x / p.w, p.y / p.w, 0.);<br>
<br>
}<br>
<br>
// compute intersection<br>
<br>
I i = ComputeRayQuadricIntersection();<br>
<br>
if (i.t < 0.0)<br>
<br>
discard;<br>
<br>
// compute color<br>
<br>
gl_FragColor = ComputeColor(color, i.N, i.P);<br>
<br>
// update depth by projecting point and updating depth coordinate<br>
<br>
// the transposed version of the projection matrix is used to<br>
<br>
// perform vector, matrix row product in one line:<br>
<br>
// M[2][*] x V = Vt x Mt[*][2] where:<br>
<br>
// % V is a column vector<br>
<br>
// % Vt is a row vector<br>
<br>
// % M is a square matrix<br>
<br>
// % Mt is the transpose of M<br>
<br>
float z = dot(vec4(i.P, 1.), gl_ProjectionMatrixTranspose[2]);<br>
<br>
float w = dot(vec4(i.P, 1.), gl_ProjectionMatrixTranspose[3]);<br>
<br>
gl_FragDepth = 0.5 * (z / w + 1.0);<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkOpenGLProperty.cxx, line 415<br>
<br>
vtkPointSpriteProperty (000000001118DD20): Couldn't build the shader program. At this point , it can be an error in a shader or a driver bug.<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 481<br>
<br>
vtkShaderProgram2 (0000000012D40520): a shader failed to compile. Its log is:<br>
<br>
WARNING: 0:89: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:143: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:159: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:196: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
WARNING: 0:207: 'assign' : implicit type conversion allowed from GLSL 1.20<br>
<br>
ERROR: 0:207: '=' : cannot convert from 'const int' to '3-component vector of float'<br>
<br>
ERROR: 0:216: 'assign' : cannot convert from '4-component vector of float' to '3-component vector of float'<br>
<br>
ERROR: 0:217: 'N' : undeclared identifier<br>
<br>
ERROR: 0:217: 'assign' : cannot convert from '3-component vector of float' to 'float'<br>
<br>
ERROR: 0:218: 'dot' : no matching overloaded function found (using implicit conversion)<br>
<br>
ERROR: 0:218: 'assign' : l-value required "d" (can't modify a varying)<br>
<br>
ERROR: 0:219: 'viewdir' : undeclared identifier<br>
<br>
ERROR: 0:219: 'assign' : cannot convert from '3-component vector of float' to 'float'<br>
<br>
ERROR: 0:220: 'vl' : undeclared identifier<br>
<br>
ERROR: 0:220: 'reflect' : no matching overloaded function found (using implicit conversion)<br>
<br>
ERROR: 0:221: 's' : undeclared identifier<br>
<br>
ERROR: 0:222: 'assign' : cannot convert from '4-component vector of float' to '3-component vector of float'<br>
<br>
WARNING: 0:251: 'assigning' : implict conversion between types allowed from GLSL 1.20<br>
<br>
<br>
<br>
. Its source code is:<br>
<br>
/*=========================================================================<br>
<br>
<br>
Program: Visualization Toolkit<br>
<br>
Module: Quadrics_fs.glsl<br>
<br>
<br>
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen<br>
<br>
All rights reserved.<br>
<br>
See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm" target="_blank">http://www.kitware.com/Copyright.htm</a> for details.<br>
<br>
<br>
This software is distributed WITHOUT ANY WARRANTY; without even<br>
<br>
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR<br>
<br>
PURPOSE. See the above copyright notice for more information.<br>
<br>
<br>
=========================================================================*/<br>
<br>
<br>
// .NAME Quadrics_fs.glsl<br>
<br>
// .SECTION Thanks<br>
<br>
// <verbatim><br>
<br>
//<br>
<br>
// This file is part of the PointSprites plugin developed and contributed by<br>
<br>
//<br>
<br>
// Copyright (c) CSCS - Swiss National Supercomputing Centre<br>
<br>
// EDF - Electricite de France<br>
<br>
//<br>
<br>
// John Biddiscombe, Ugo Varetto (CSCS)<br>
<br>
// Stephane Ploix (EDF)<br>
<br>
//<br>
<br>
// </verbatim><br>
<br>
<br>
//<br>
<br>
// IN:<br>
<br>
// - vertex position<br>
<br>
// - point size<br>
<br>
// - ray origin<br>
<br>
// - perspective flag<br>
<br>
// - quadric equation coefficients<br>
<br>
// - color<br>
<br>
// - viewport (width and height only)<br>
<br>
// - min point size (pointThreshold)<br>
<br>
//<br>
<br>
// OUT:<br>
<br>
// - fragment color computed from point intersected by ray shot from<br>
<br>
// viewpoint through point computed from current fragment coordinate<br>
<br>
// - fragment depth computed by projecting the intersection point into screen<br>
<br>
// coordinates<br>
<br>
<br>
<br>
// OPTIMAL<br>
<br>
#define ELLIPSOID<br>
<br>
//#define CYLINDER<br>
<br>
//#define CONE<br>
<br>
//#define HYPERBOLOID1<br>
<br>
//#define HYPERBOLOID2<br>
<br>
//#define PARABOLOID<br>
<br>
<br>
// SUB OPTIMAL<br>
<br>
//#define HYPER_PARABOLOID<br>
<br>
<br>
uniform vec2 viewport; // only width and height passed, no origin<br>
<br>
uniform float pointSizeThreshold; // minimum point size<br>
<br>
<br>
varying vec4 color;<br>
<br>
varying float a;<br>
<br>
varying float b;<br>
<br>
varying float c;<br>
<br>
varying float d;<br>
<br>
varying float e;<br>
<br>
varying float f;<br>
<br>
varying float g;<br>
<br>
varying float h;<br>
<br>
varying float i;<br>
<br>
varying float j;<br>
<br>
varying float pointSize;<br>
<br>
varying float perspective;<br>
<br>
<br>
vec3 raydir; // ray direction in screen space<br>
<br>
vec3 rayorigin; // ray origin in screen space<br>
<br>
<br>
#ifndef ELLIPSOID<br>
<br>
varying mat4 Ti;<br>
<br>
#endif<br>
<br>
<br>
const float FLAT_SHADE_POINT_SIZE = 1.0; //if point size < 1 use flat shading<br>
<br>
<br>
const float FEPS = 0.0001;<br>
<br>
<br>
const float BOUND = 1.0 + FEPS;<br>
<br>
<br>
const vec3 MIN_BOUND = vec3(-BOUND);<br>
<br>
<br>
const vec3 MAX_BOUND = vec3(BOUND);<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// BOUNDS CHECK<br>
<br>
// in general it makes sense to check only along the z direction for:<br>
<br>
// - paraboloids<br>
<br>
// - hyperboloids of one sheet<br>
<br>
// - cylinders<br>
<br>
// - cones<br>
<br>
// and no checking at all is required for ellipsoids<br>
<br>
#ifndef ELLIPSOID<br>
<br>
bool InBounds( vec3 P )<br>
<br>
{<br>
<br>
vec4 v = Ti * gl_ModelViewMatrixInverse * vec4( P, 1. );<br>
<br>
#if defined( CYLINDER ) || defined( CONE ) || defined( HYPERBOLOID1 ) || defined( PARABOLOID )<br>
<br>
return v.z >= -BOUND && v.z <= BOUND;<br>
<br>
#else<br>
<br>
return all( greaterThanEqual( v.xyz, MIN_BOUND ) ) &&<br>
<br>
all( lessThanEqual( v.xyz, MAX_BOUND ) );<br>
<br>
#endif<br>
<br>
}<br>
<br>
#endif<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// INTERSECTION<br>
<br>
struct I<br>
<br>
{<br>
<br>
vec3 P;<br>
<br>
vec3 N;<br>
<br>
float t;<br>
<br>
};<br>
<br>
<br>
// compute unit normal from gradient<br>
<br>
vec3 ComputeNormal(vec3 P)<br>
<br>
{<br>
<br>
return normalize(vec3(dot(vec4(a, d, e, 1.), vec4(P, g)), // should multiply by 2 for actual gradient<br>
<br>
dot(vec4(d, b, f, 1.), vec4(P, h)), // should multiply by 2 for actual gradient<br>
<br>
dot(vec4(e, f, c, 1.), vec4(P, i)) // should multiply by 2 for actual gradient<br>
<br>
));<br>
<br>
}<br>
<br>
<br>
// compute ray quadric intersection; if no intersection occurs I.t is < 0<br>
<br>
// main axis length and orientation are used to clip the quadric; not<br>
<br>
// required for closed quadrics (ellipsoids)<br>
<br>
// | a d e g |<br>
<br>
// | d b f h |<br>
<br>
// | e f c i |<br>
<br>
// | g h i j |<br>
<br>
// ax^2 + by^2 + cz^2 + 2dxy +2exz + 2fyz + 2gx + 2hy + 2iz + j = 0<br>
<br>
/// @todo pass vec3(a, b, c), vec3( d, e, f ) and vec3( g, h, i ) instead of single coefficients<br>
<br>
I ComputeRayQuadricIntersection()<br>
<br>
{<br>
<br>
I ip;<br>
<br>
ip.t = -1.0;<br>
<br>
vec3 P = rayorigin;<br>
<br>
vec3 D = raydir;<br>
<br>
float A = 0.0;<br>
<br>
float B = 0.0;<br>
<br>
float C = 0.0;<br>
<br>
if (bool(perspective))<br>
<br>
{<br>
<br>
A = dot(vec3(a, b, c), D * D) + 2. * dot(vec3(d, e, f), D.xxy * D.yzz);<br>
<br>
B = 2. * dot(vec3(g, h, i), D);<br>
<br>
C = j;<br>
<br>
}<br>
<br>
else<br>
<br>
{<br>
<br>
A = c;<br>
<br>
//B = -2. * dot( vec4( c, e, f, 1. ), vec4( P.zxy, 1. ) );<br>
<br>
B = -2. * dot(vec4(d, e, f, i), vec4(P.zxy, 1.));<br>
<br>
C = dot(vec3(a, b, c), P * P) + 2. * (dot(vec3(d, e, f), P.xxy * P.yzz)<br>
<br>
+ dot(vec3(g, h, i), P)) + j;<br>
<br>
}<br>
<br>
float delta = B * B - 4. * A * C;<br>
<br>
if (delta < 0.0)<br>
<br>
return ip;<br>
<br>
float d = sqrt(delta);<br>
<br>
A = 1. / A;<br>
<br>
A *= 0.5;<br>
<br>
float t2 = A * (-B + d);<br>
<br>
float t1 = A * (-B - d);<br>
<br>
#ifdef ELLIPSOID<br>
<br>
ip.P = rayorigin + D * min(t1, t2);<br>
<br>
ip.N = ComputeNormal(ip.P);<br>
<br>
ip.t = 0.;<br>
<br>
#else<br>
<br>
vec3 P1 = rayorigin + D * min( t1, t2 );<br>
<br>
vec3 P2 = rayorigin + D * max( t1, t2 );<br>
<br>
if( InBounds( P1 ) )<br>
<br>
{<br>
<br>
ip.P = P1;<br>
<br>
ip.N = ComputeNormal( P1 );<br>
<br>
ip.t = 0.;<br>
<br>
}<br>
<br>
else if( InBounds( P2 ) )<br>
<br>
{<br>
<br>
ip.P = P2;<br>
<br>
ip.N = ComputeNormal( P2 );<br>
<br>
ip.t = 0.;<br>
<br>
}<br>
<br>
#endif<br>
<br>
return ip;<br>
<br>
}<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// LIGHTING, standard phong lighting model<br>
<br>
vec3 lightDir = normalize(vec3(0.1, 0.1, 1.));<br>
<br>
float kd = 1.0;<br>
<br>
float ka = 0.01;<br>
<br>
float ks = .5;<br>
<br>
float sh = 90.0;<br>
<br>
vec4 refcolor = vec4(1., 1., 1., 1.);<br>
<br>
vec4 ComputeColor(vec4 color, vec3 n, vec3 P)<br>
<br>
{<br>
<br>
if (pointSize < FLAT_SHADE_POINT_SIZE)<br>
<br>
return color;<br>
<br>
<br>
vec3 col = (0, 0, 0);<br>
<br>
vec3 N;<br>
<br>
float d;<br>
<br>
vec3 viewdir;<br>
<br>
float vl;<br>
<br>
float s;<br>
<br>
<br>
for (int li = 0; li < 4; li++)<br>
<br>
{<br>
<br>
lightDir = normalize(gl_LightSource[li].position);<br>
<br>
N = faceforward(-n, lightDir, n);<br>
<br>
d = dot(N, lightDir);<br>
<br>
viewdir = normalize(-P);<br>
<br>
vl = max(0., dot(reflect(-lightDir, N), viewdir));<br>
<br>
s = pow(vl, gl_FrontMaterial.shininess);<br>
<br>
col += gl_FrontMaterial.specular * s * gl_LightSource[li].specular.rgb + kd<br>
<br>
* d * color.rgb * gl_LightSource[li].diffuse.rgb + ka * color.rgb<br>
<br>
* gl_LightSource[li].ambient.rgb;<br>
<br>
}<br>
<br>
<br>
return vec4(col, color.a);<br>
<br>
<br>
}<br>
<br>
<br>
//------------------------------------------------------------------------------<br>
<br>
// MAIN<br>
<br>
void propFuncFS(void)<br>
<br>
{<br>
<br>
if (pointSize < pointSizeThreshold || color.a <= 0.0)<br>
<br>
discard;<br>
<br>
vec3 fc = gl_FragCoord.xyz;<br>
<br>
fc.xy /= viewport;<br>
<br>
fc *= 2.0;<br>
<br>
fc -= 1.0;<br>
<br>
vec4 p = gl_ProjectionMatrixInverse * vec4(fc, 1.);<br>
<br>
if (bool(perspective))<br>
<br>
{<br>
<br>
// in perspective mode, rayorigin is always at (0, 0, 0)<br>
<br>
rayorigin = vec3(0., 0., 0.);<br>
<br>
raydir = vec3(p) / p.w;<br>
<br>
}<br>
<br>
else<br>
<br>
{<br>
<br>
// in orthographic mode, raydir is always ( 0., 0., -1. );<br>
<br>
raydir = vec3(0., 0., -1.);<br>
<br>
rayorigin = vec3(p.x / p.w, p.y / p.w, 0.);<br>
<br>
}<br>
<br>
// compute intersection<br>
<br>
I i = ComputeRayQuadricIntersection();<br>
<br>
if (i.t < 0.0)<br>
<br>
discard;<br>
<br>
// compute color<br>
<br>
gl_FragColor = ComputeColor(color, i.N, i.P);<br>
<br>
// update depth by projecting point and updating depth coordinate<br>
<br>
// the transposed version of the projection matrix is used to<br>
<br>
// perform vector, matrix row product in one line:<br>
<br>
// M[2][*] x V = Vt x Mt[*][2] where:<br>
<br>
// % V is a column vector<br>
<br>
// % Vt is a row vector<br>
<br>
// % M is a square matrix<br>
<br>
// % Mt is the transpose of M<br>
<br>
float z = dot(vec4(i.P, 1.), gl_ProjectionMatrixTranspose[2]);<br>
<br>
float w = dot(vec4(i.P, 1.), gl_ProjectionMatrixTranspose[3]);<br>
<br>
gl_FragDepth = 0.5 * (z / w + 1.0);<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkOpenGLProperty.cxx, line 415<br>
<br>
vtkPointSpriteProperty (000000001118DD20): Couldn't build the shader program. At this point , it can be an error in a shader or a driver bug.<br>
<br>
<br>
</div></div>Cheers,<br>
<br>
Bruce<br>
<div><br>
<br>
On Mon, Feb 10, 2014 at 11:51 AM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




Atleast, we need to know what shader its trying to use which is failing to compile on your system (TextureSprite, Quadrics (Attribute or Fixed Radius))<br>
<br>
<br>
</div><div>On Mon, Feb 10, 2014 at 11:44 AM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




Hi Bruce,<br>
<br>
Sorry, I thought replied to your email. In the log you sent me, I do see that it is stating that point sprites are supported. If you can put a break point in vtkPointSpriteProperty (at the error line) then we can find out exactly where the error is coming from.<br>




<br>
</div>- Aashish<br>
<div><br>
<br>
<br>
On Mon, Feb 10, 2014 at 11:14 AM, Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>> wrote:<br>




Is there anything else I can do to help debug this problem? It is quite frustrating to not have pointsprite working on this machine.<br>
<br>
Cheers,<br>
Bruce<br>
<br>
<br>
</div><div>On Sun, Jan 26, 2014 at 6:26 PM, Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>> wrote:<br>




Ok, I've attached the output from glview. Everything is supported for OpenGL <=4.2. versions 4.3 and 4.4 are partially supported.<br>
<br>
Cheers,<br>
Bruce<br>
<br>
<br>
</div><div>On Thu, Jan 23, 2014 at 11:51 AM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




<a href="http://www.realtech-vr.com/glview/" target="_blank">http://www.realtech-vr.com/glview/</a><br>
<br>
<br>
</div><div>On Wed, Jan 22, 2014 at 9:35 AM, Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>> wrote:<br>




This is windows 8.1, is there a similar utility I can run on windows?<br>
<br>
Cheers,<br>
Bruce<br>
<br>
<br>
</div><div>On Wed, Jan 22, 2014 at 9:31 AM, Aashish Chaudhary <<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a><mailto:<a href="mailto:aashish.chaudhary@kitware.com" target="_blank">aashish.chaudhary@kitware.com</a>>> wrote:<br>




Is this a windows OS or Linux? If Linux can you send us the output of glxinfo (as a starting point to debug this).<br>
<br>
Thanks,<br>
<br>
<br>
<br>
</div><div>On Wed, Jan 22, 2014 at 8:56 AM, Bruce Jones <<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a><mailto:<a href="mailto:bruce.david.jones@gmail.com" target="_blank">bruce.david.jones@gmail.com</a>>> wrote:<br>




When using the PointSprite plugin on a new laptop I found two options cause it to stop working.<br>
<br>
When changing from "Sphere (texture)" to "Sphere"  get the following,<br>
<br>
<br>
</div><div>ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkOpenGLProperty.cxx, line 415<br>
<br>
</div><div>vtkPointSpriteProperty (000000000BD110B0): Couldn't build the shader program. At this point , it can be an error in a shader or a driver bug.<br>
<br>
<br>
I thought this might be due to lack of opengl support for the graphics chip, which comes bundled with the I7-4600u I have. However intel claim it supports up to version 4.2 of OpenGL, so that should be fine...<br>
<br>
<br>
Also, when i choose to scale the point sprite size by values in an array, I get the following error,<br>
<br>
<br>
</div><div>ERROR: In C:\DBD\pvs-x64\paraview\src\paraview\VTK\Rendering\OpenGL\vtkShaderProgram2.cxx, line 1084<br>
<br>
</div>vtkShaderProgram2 (0000000014D4A1A0): glGetAttribLocation 1 OpenGL errors detected<br>
<br>
0 : (1281) Invalid value<br>
<br>
<div><br>
Is there any solution for this?<br>
<br>
<br>
Cheers,<br>
<br>
Bruce<br>
<br>
_______________________________________________<br>
</div>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br>
<br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div><br>
<br>
<br>
--<br>
| Aashish Chaudhary<br>
| R&D Engineer<br>
| Kitware Inc.<br>
</div>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>    
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>| Aashish Chaudhary <br>| R&D Engineer         <br>| Kitware Inc.            <br>| <a href="http://www.kitware.com">www.kitware.com</a>    
</div>