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

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Sun Jul 19 08:22:06 PDT 2015


Am 18.07.2015 um 16:32 schrieb Elias Tarasov:
> Hello!
>
> GPU: nVidia 540M
> Driver: 353.30
> OpenGL version: 4.3.
> OS Windows 7
>
> I intend to use osgHimmel library in my project.
> However, when i run the app, i get the shader's compile error:
>
> Atmopshere Precomputed (took 7.95881 s)
> Warning, can't assign attribute binding as no has been array assigned to set binding
> PNG lib warning : iCCP: known incorrect sRGB profile
> PNG lib warning : iCCP: known incorrect sRGB profile

> </snip>
> 0(5) : error C0204: version directive must be first statement and may not be repeated
>
> Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)
> Warning: detected OpenGL error 'invalid value' at after RenderBin::draw(..)
>
> I have several objects, each of which uses Vertex, Fragment, and Geometry shaders.
> With a help of community's members here, i found the place where the error might be:
>
> const std::string glsl_version_150()
> {
> 	static const std::string source(PRAGMA_ONCE(version,"#version 150 compatibility\n\n"));
> 	return source;
> };

Where is this line of code? Inside your code?
>
> This function is called every time to create any shader. And therefore #version directive is realy called multiple times.
> According to OpenGL SL #version must be the first line and cannot be repeated.
> However, this definition is unclear: Is #version must be the one and only one for the entire host OpenGL program? For the host object that uses shader? Or for every single main() entry of the shader?
Each source string needs to have the version line once and at the 
beginning. Basically everything you load via loadShaderSource or 
setShaderSource. (glShaderSource basically)
>
> Can anybody pointed out how to solve that issue?
I'm afraid you will need to check the osgHimmel code for this if it is 
setting up the shaders. Have you tried to comment out the line above? 
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).
Also check the osgShader example. Is it running as expected?

As long as you don't provide more information on what is going wrong on 
your side, chances are slim we can help you
>
> Thank you!
>
> Cheers,
> Elias
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64358#64358
>
>
>
>
>
> _______________________________________________
> 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