[osg-users] OpenGL Shader Compile Problem: repeated #version directive

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Mon Jul 20 00:23:56 PDT 2015


Hi Elias,

First of all, please try to condense the error logs to a minimum when 
posting them. (and maybe attach them if you think someone wants to read 
them ;-))

> Hi!
>
> 1.
>
>>
>>> </snip>
>>> 0(5) : error C0204: version directive must be first statement and may not be repeated
>>>
>> Where is this line of code? Inside your code?
>>
>
> No, that line is in osgHimmel code.
>
> 2.
>
>> Have you tried to comment out the line above?
>>
>
> Yes, and in this case the error is:
>
> Atmopshere Precomputed (took 7.45826 s)
> Warning, can't assign attribute binding as no has been array assigned to set binding for.
> PNG lib warning : iCCP: known incorrect sRGB profile
> PNG lib warning : iCCP: known incorrect sRGB profile
> VERTEX glCompileShader "" FAILED
> VERTEX Shader "" infolog:
> 0(27) : error C5060: out can't be used with non-varying m_eye
> 0(28) : error C5060: out can't be used with non-varying m_ray
Okay that means you really need version 1.5 or above.
> ...
> 3.
>
>> Have you debugged with geDebugger or glIntercept to see which shader
>> source is sent to the driver? (You can also check the osg::Shader apply
>> i think).
>>
>
> Here is the header pattern of all osgHimmel shaders under gDEBugger:
>
> #ifndef __version__
> #define __version__
>
> #version 150 compatibility
>
> #endif // __version__
Okay if I understand your initial error message correctly, the above 
code is the troublemaker
the first line is #ifndef and not the #version ...
I believe the above construct might be considered invalid as #version 
and #ifdef are both preprocessor tags. So first line literally means 
first line of the source.
> 4.
>
>> Also check the osgShader example. Is it running as expected?
>>
>
> Yes, osgShaders works fine.
>
> 5. Also, i found that link:
> https://www.opengl.org/discussion_boards/showthread.php/185603-Managing-several-versions-in-a-single-shader-file
> There is a solution that maybe works: somehow pass version number through API.
I would contact the author of osgHimmel to fix the above problem. You 
could try yourself by removing the #ifdef and put the version in the 
first line for a quick check.
Unfortunately I cannot help you further with this as it seems specific 
to osgHimmel.

Cheers
Sebastian
>
> Or something else maybe?
>
> Thanks for help and patience!
>
> Cheers,
> Elias
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64364#64364
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list