Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hello,
I have written vShader and fShader in GLSL ES 3.0. I can compile them without errors and I link them to Shader-programm. Now, when i initilaise them like this: positionIdx = gl.glGetAttribLocation(shaderProgram, "a_position"); the int-value of "positionIdx" is -1.What can be a problem? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Shader compilers are allowed to optimize away "in" parameters (and uniforms) that are not used in the shader program. So even if "a_position" is declared in the shader, if it is not used you can get -1 as result.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In my opinion, i use that Parameters in Shaders.
Hier is a vShader: in vec4 a_position; void main() { gl_Position = a_position; } and a fShader: in vec2 a_texCoord; uniform sampler2D s_texture; layout(location = 0) out vec4 data; void main () { data = texture(s_texture, a_texCoord); } I initialise them like this: int positionIdx = gl.glGetAttribLocation(shaderProgram, "a_position"); int texCoordIdx = gl.glGetAttribLocation(shaderProgram, "a_texCoord"); int sampIdx = gl.glGetUniformLocation(shaderProgram, "s_texture"); Are my Shaders broken? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The only thing I can think of is that they are missing a version tag. For example #version 410 core
So maybe your driver considers them an "old" version of GLSL and fails somehow but that should've resulted in them not compiling. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Yes, i had this idea too.
I have added "#version 300 es" at the beginning of Shaders. On PC there is an Error: "Incorrect GLSL version for token es: 300" Not a Problem, because the RasPi can compile Shaders without Errors. But the int-Values are still -1. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I thought RasPi was GLES 2.0 only? If you give it GLES 3 shaders I guess they will fail to compile and maybe the compiler isn't nice enough to tell you they failed.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
On 02/13/2014 02:22 PM, jmaasing [via jogamp] wrote:
> I thought RasPi was GLES 2.0 only? If you give it GLES 3 shaders I guess they > will fail to compile and maybe the compiler isn't nice enough to tell you they > failed. Note: If you look at our GearsES2 demo - or any other utilizing ShaderCode, you will see that we add the GLSL version tag and other defines at runtime depending on the used GLContext version. Check call hierarchy on 'ShaderCode.addGLSLVersion(GL2ES2 gl)'. Reason we do this is, b/c some GL implementation can by very picky and refuse to run any shader code not matching the GLContext version. ~Sven |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
... [show rest of quote]
I did not know that, nice feature :-)
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thank you for answers.
The error was in Shader, I have not see it because the Compiler on Raspi has compile it without errors. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Take a look at the JOGL wiki where we have collected knowledge on how to write cross GLProfile compatible shaders: http://jogamp.org/wiki/index.php/How_to_write_cross_GLProfile_compatible_shader_using_JOGL 2014-02-18 12:40 GMT+01:00 Vasilij [via jogamp] <[hidden email]>: Thank you for answers. |
Free forum by Nabble | Edit this page |