This is my dump of easy fixes for problems that pop up from time to time. As I am quite the novice with both OpenGL and shaders, they do stop my progress quite so often. So hopefully this will help someone else who is googling for the solutions. :)
I guess that this list will grow over time.
For more on OpenGL, look up my tutorial series starting with:
OpenGL 4 with OpenTK in C# Part 1: Initialize the GameWindow
error C7565
0(18) : error C7565: assignment to varying 'tes_out'Check that tes_out actually is declared as out. Copying from previous shader one might forget to change it to in in the next.
error C1035
0(18) : error C1035: assignment of incompatible typesExample of faulty code.
in TCS_OUT { vec4 color; } tes_in[]; out TES_OUT { vec4 color; } tes_out; void main(void) { /* threw error */ tes_out = tes_in[0]; /* fixed, uncomment */ /* tes_out.color = tes_in[0].color; */ }
Other errors could be assignment of a vec3 to a vec4.
error C3008
0(4) : error C3008: unknown layout specifier 'max_vertices = 3' 0(4) : error C3008: unknown layout specifier 'points'I had loaded an geometry shader, but told OpenGL that it was an Tesselation Evaluation Shader, so changing the type to the correct one solved it.
error C3004
0(22) : error C3004: function "void EmitVertex();" not supported in this profileI had loaded an geometry shader, but told OpenGL that it was an Tesselation Evaluation Shader, so changing the type to the correct one solved it.
error C1048
0(14) : error C1048: invalid character 'Y' in swizzle "Y"This one was tricky, turned out that all vecX are referenced by lower case letters. Error message was from when trying to reference with upper case. Or any other non-existent letter
vec4 color; color.A // this is wrong color.a // this is right
Program linking warning
warning: two vertex attribute variables (named position and color) were assigned to the same generic vertex attributeJust as described, had set the location of two attributes to the same (0), solved by assigning correct location i.e. 0 and 1 in this case.
layout (location = 0) in vec4 position; layout(location = 0) in vec4 color;
Addition of Tessellation Control Shader and Tessellation Evaluation Shader results in black screen
Works fine when running only Vertex Shader and Fragment Shader, but when adding Tesselation, it just stops working. Took me 3 hours of trying to understand what I missed in the examples until I found that if you use Tesselation, you need to change from Triangles to Patches.
GL.DrawArrays(PrimitiveType.Patches, 0, 3);
No comments:
Post a Comment