Hi Glenn,

My guess is that the best solution would to have the
osg::State::convertShaderSourceToOsgBuilts() check for the initial #
directivtives and place the OSG declarations there.  Feel free to put
together a modification osg to do this :-)

Robert.

On Mon, Jan 3, 2011 at 9:46 PM, Glenn Waldron <[email protected]> wrote:
> Hi Robert,
> I'm seeing the following GLSL compile error. It looks like the code in
> State::convertShaderSourceToOsgBuiltins() is inserting declarations before
> the "#version" directive, which is apparently illegal. (Only on one of our
> machines does OSG even go down this code path ... I am still investigating
> why that is.)
> Let me know if you will accept a patch to insert declarations after any GLSL
> compiler directives, or whether you think another solution would be more
> appropriate. Thanks.
>
> State::convertShaderSourceToOsgBuiltIns()
> ++Before Converted source
> #version 110
> uniform mat4 osgearth_overlay_TexGenMatrix;
> uniform mat4 osg_ViewMatrixInverse;
> void osgearth_overlay_vertex(void)
> {
>     gl_TexCoord[0] = osgearth_overlay_TexGenMatrix * osg_ViewMatrixInverse *
> gl_ModelViewMatrix * gl_Vertex;
> }
>
> ++++++++
> -------- Converted source
> uniform mat4 osg_ModelViewMatrix;
> attribute vec4 osg_Vertex;
> #version 110
> uniform mat4 osgearth_overlay_TexGenMatrix;
> uniform mat4 osg_ViewMatrixInverse;
> void osgearth_overlay_vertex(void)
> {
>     gl_TexCoord[0] = osgearth_overlay_TexGenMatrix * osg_ViewMatrixInverse *
> osg_ModelViewMatrix * osg_Vertex;
> }
>
> ----------------
> VERTEX glCompileShader "osgearth_overlay_vertex" FAILED
> VERTEX Shader "osgearth_overlay_vertex" infolog:
> 0(3) : error C0204: version directive must be first statement and may not be
> repeated
>
> Glenn Waldron : Pelican Mapping : +1.703.652.4791
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to