Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualVilem Otte

Posted 17 June 2013 - 02:46 AM

First of all I assume that rendering single triangle with only VS and FS works (e.g. you don't have issues in calling glDrawArrays/glDrawElements).
 
Some points that probably cause issues:
1.) Names with out qualifier in some shader should correspond to names with in qualifier in the shader describing next stage. At least unless you use layout qualifier and separate shader objects extensions... e.g.:
// Standard way of passing "varyings" from one shader to another. The GLSL compliler does pattern
// matching between their names and connects them.
[Vertex Shader]
out vec3 vsVertexPosition;
out vec3 vsVertexNormal;

[Geometry Shader]
in vec3 vsVertexPosition[];
in vec3 vsVertexNormal[];

// Another possible way since ARB_separate_shader_objects - available since OpenGL 4.1, core
// since OpenGL 4.3 - this one explicitly says which "varyings" links together. Note that
// using this approach the corresponding ones can have different names! Otherwise they can't
[Vertex Shader]
layout(location = 0) out vec3 position;
layout(location = 1) out vec3 normal;

[Geometry Shader]
layout(location = 0) in vec3 pos;
layout(location = 1) in vec3 n;

// But this is NOT possible, the GLSL compiler can't tell which variables can be connected
// together.
[Vertex Shader]
out vec3 pos;
out vec3 normal;

[Geometry Shader]
in vec3 mPosition;
in vec3 mNormal;
2.) Version definition should be same in all shaders! On AMD this can result in error and compilation will fail, thus the shaders won't run.

3.) Don't mix gl_in/gl_out and in/out. This is bad and results in (very) messy shaders.

4.) Tessellation shaders should have
#extension GL_ARB_tessellation_shader : enable
These are just few points by quickly going through your code. I can post you shader code of very basic tessellation example that works - if you can't make it work. It's really very basic example that needs just 2 parameters - view and projection matrices.

#1Vilem Otte

Posted 17 June 2013 - 02:44 AM

First of all I assume that rendering single triangle with only VS and FS works (e.g. you don't have issues in calling glDrawArrays/glDrawElements).
 
Some points that probably cause issues:
1.) Names with out qualifier in some shader should correspond to names with in qualifier in the shader describing next stage. At least unless you use layout qualifier and separate shader objects extensions... e.g.:
// Standard way of passing "varyings" from one shader to another. The GLSL compliler does pattern
// matching between their names and connects them.
[Vertex Shader]
out vec3 vsVertexPosition;
out vec3 vsVertexNormal;

[Geometry Shader]
in vec3 vsVertexPosition[];
in vec3 vsVertexNormal[];

// Another possible way since ARB_separate_shader_objects - available since OpenGL 4.1, core
// since OpenGL 4.3 - this one explicitly says which "varyings" links together. Note that
// using this approach the corresponding ones can have different names! Otherwise they can't
[Vertex Shader]
layout(location = 0) out vec3 position;
layout(location = 1) out vec3 normal;

[Geometry Shader]
layout(location = 0) in vec3 pos;
layout(location = 1) in vec3 n;

// But this is NOT possible, the GLSL compiler can't tell which variables can be connected
// together.
[Vertex Shader]
out vec3 pos;
out vec3 normal;

[Geometry Shader]
in vec3 mPosition;
in vec3 mNormal;
2.) Version definition should be same in all shaders! On AMD this can result in error and compilation will fail, thus the shaders won't run.

3.) Don't mix gl_in/gl_out and in/out. This is bad and results in (very) messy shaders.

4.) Tessellation shaders should have
#extension GL_ARB_tessellation_shader : enable
These are just few points by quickly going through your code. I might post you shader code of very basic tessellation example that works.

PARTNERS