[osg-users] StandardShadowMap and Fog

2015-02-01 Thread Trajce Nikolov NICK
Hi Community,

I am seeing in the default fragment shader (snippet bellow) that a fog is
used into account but for some reason I can not make it work. Any hints for
the Fog settings?

Thanks a lot

#if FRAGMENT_SHADERS_ONLY
_mainFragmentShader = new osg::Shader( osg::Shader::FRAGMENT,
 // following expressions are auto modified - do not change
them:   \n
 // gl_TexCoord[0]  0 - can be subsituted with other
index  \n

\n
float DynamicShadow(
); \n

\n
uniform sampler2D
baseTexture;  \n

\n
void
main(void) \n

{   \n
  vec4 colorAmbientEmissive =
gl_FrontLightModelProduct.sceneColor; \n
//  // Add ambient from Light of index =
0\n
//  colorAmbientEmissive +=
gl_FrontLightProduct[0].ambient;  \n
  vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy
); \n
  color *= mix( colorAmbientEmissive, gl_Color, DynamicShadow()
);  \n
#if DISPLAY_SHADOW_TEXEL_TO_PIXEL_ERROR
  color.xy = abs( dFdy( gl_TexCoord[1].xy / gl_TexCoord[1].w ) )*
1024.0; \n
  color.z = color.y; \n
  color.x = color.z; \n
  color.y = color.z; \n
  color.a = 1.0; \n
#endif
//float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale,
0.,1.);\n
//color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog
);  \n
  gl_FragColor =
color; \n
} \n );

-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] StandardShadowMap and Fog

2015-02-01 Thread Trajce Nikolov NICK
never mind .. blind me.. It is commented out .. Please ignore

Nick

On Sun, Feb 1, 2015 at 3:21 PM, Trajce Nikolov NICK 
trajce.nikolov.n...@gmail.com wrote:

 Hi Community,

 I am seeing in the default fragment shader (snippet bellow) that a fog is
 used into account but for some reason I can not make it work. Any hints for
 the Fog settings?

 Thanks a lot

 #if FRAGMENT_SHADERS_ONLY
 _mainFragmentShader = new osg::Shader( osg::Shader::FRAGMENT,
  // following expressions are auto modified - do not change
 them:   \n
  // gl_TexCoord[0]  0 - can be subsituted with other
 index  \n

 \n
 float DynamicShadow(
 ); \n

 \n
 uniform sampler2D
 baseTexture;  \n

 \n
 void
 main(void) \n

 {   \n
   vec4 colorAmbientEmissive =
 gl_FrontLightModelProduct.sceneColor; \n
 //  // Add ambient from Light of index =
 0\n
 //  colorAmbientEmissive +=
 gl_FrontLightProduct[0].ambient;  \n
   vec4 color = texture2D( baseTexture, gl_TexCoord[0].xy
 ); \n
   color *= mix( colorAmbientEmissive, gl_Color, DynamicShadow()
 );  \n
 #if DISPLAY_SHADOW_TEXEL_TO_PIXEL_ERROR
   color.xy = abs( dFdy( gl_TexCoord[1].xy / gl_TexCoord[1].w ) )*
 1024.0; \n
   color.z = color.y; \n
   color.x = color.z; \n
   color.y = color.z; \n
   color.a = 1.0; \n
 #endif
 //float fog = clamp((gl_Fog.end - gl_FogFragCoord)*gl_Fog.scale,
 0.,1.);\n
 //color.rgb = mix( gl_Fog.color.rgb, color.rgb, fog
 );  \n
   gl_FragColor =
 color; \n
 } \n );

 --
 trajce nikolov nick




-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] (no subject)

2015-02-01 Thread Robert Osfield
Hi Phileppe,

I presume Qt5.4 is define the various GL values in it's headers as well as
the OSG.  You could try changing the include order of the Qt and OSG
headers to see if that can resolve the issue.  I don't have Qt5.4 on my
system to test against so I'll have to defer to you to see if you can find
a solution.  If you do just let me know the changes required and we can
then discuss how to tweak the OSG or it's Qt usage to avoid the issues.

Robert.

On 31 January 2015 at 22:03, philippe renon philippe_re...@yahoo.fr wrote:

 I am also seeing this warnings multiple times:

 [ 92%] Building CXX object
 src/applications/osgearth_package_qt/CMakeFiles/application_osgearth_package_qt.dir/package_qt.cpp.obj
 In file included from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtGui/qopengl.h:123:0,
  from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtOpenGL/qgl.h:39,
  from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtOpenGL/QGLWidget:1,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osgQt/GraphicsWindowQt:17,
  from
 d:/Projects/OpenPilot/3rdparty/osgearth/src/osgEarthQt/ViewerWidget:26,
  from
 d:\Projects\OpenPilot\3rdparty\osgearth\src\applications\osgearth_package_qt\package_qt.cpp:26:
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtGui/qopenglext.h:2431:0:
 warning: GL_SHADER_STORAGE_BARRIER_BIT redefined
  #define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
  ^
 In file included from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/GLExtensions:18:0,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/BufferObject:19,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/Array:46,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/Shape:21,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/KdTree:17,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osgDB/Registry:21,
  from
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osgDB/FileUtils:17,
  from
 d:\Projects\OpenPilot\3rdparty\osgearth\src\applications\osgearth_package_qt\package_qt.cpp:21:
 D:/Projects/OpenPilot/build/3rdparty/install/osg-3.3.3-mingw491_32-qt-5.4.0/include/osg/GLDefines:496:0:
 note: this is the location of the previous definition
  #define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
  ^

 PS : sorry for the missing email object.




   Le Samedi 31 janvier 2015 21h44, philippe renon philippe_re...@yahoo.fr
 a écrit :



 Hi,

 Compilation of osg 3.2.1 against Qt 5.4.0 (mingw) was working perfectly
 fine.

 After switching to 3.3.3 we are seeing this compilation error :

 In file included from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtGui/qopengl.h:123:0,
  from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtOpenGL/qgl.h:39,
  from
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtOpenGL/QGLWidget:1,
  from
 d:/Projects/OpenPilot/3rdparty/osg/include/osgQt/GraphicsWindowQt:17,
  from
 d:\Projects\OpenPilot\3rdparty\osg\examples\osgviewerQt\osgviewerQt.cpp:12:
 d:/Projects/OpenPilotTools/qt-5.4.0/5.4/mingw491_32/include/QtGui/qopenglext.h:10653:130:
 error: 'GLintptrARB' has not been declared
  typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint
 video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);

 The issue comes from a conflict between
osg/include/osg/BufferObject
 and
qt-5.4.0/5.4/mingw491_32/include/QtGui/qopenglext.h

 within the section starting with:
#ifndef GL_ARB_vertex_buffer_object
#define GL_ARB_vertex_buffer_object

 I beleive that this issue was introduced by openscenegraph/osg
 https://github.com/openscenegraph/osg/commit/2c9d3671404583e797e9fdd5cc7687985c1bdf3b#diff-9e6bea70325f4962c2d5c856e6e5001c


 [image: image]
 https://github.com/openscenegraph/osg/commit/2c9d3671404583e797e9fdd5cc7687985c1bdf3b#diff-9e6bea70325f4962c2d5c856e6e5001c





 openscenegraph/osg
 https://github.com/openscenegraph/osg/commit/2c9d3671404583e797e9fdd5cc7687985c1bdf3b#diff-9e6bea70325f4962c2d5c856e6e5001c
 osg - OpenSceneGraph git mirror
 Afficher sur github.com
 https://github.com/openscenegraph/osg/commit/2c9d3671404583e797e9fdd5cc7687985c1bdf3b#diff-9e6bea70325f4962c2d5c856e6e5001c
 Aperçu par Yahoo


 Regards,
 Philippe.




 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org