I have these 2 shaders:
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) in vec3 in_position;
layout(binding = 0) uniform MVPOnlyUbo {
mat4 model;
mat4 view;
mat4 proj;
} ubo;
void main()
{
gl_PointSize = 5.f;
gl_Position = vec4(in_position.xy, 0.5, 1.0);
}
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) out vec4 color_out;
void main()
{
color_out = vec4(0, 1, 0, 1);
}
Which are as simple as they can get.
If modify the vertex shader to do:
gl_Position = ubo.proj * ubo.view * vec4(in_position.xy, 0.5, 1.0);
I see this (correct):
If I instead do the orthogonal projection:
gl_Position = vec4(in_position.xy, 0.5, 1.0);
I see this (i.e. all the points seem to conglomerate in either y=0 or y=-1):
What is particularly strange to me is that if I inspect things with renderdoc I see this as the mesh and vertex values (for the non working version):
So the vertex in and vertex out are correct, the VS is emitting the attribute input without modification. And renderdoc itself shows this as the output:
I should be seeing a cloud of green points in the bottom right corner of my screen, why am I seeing 2 lines and nothing inside the quadrant?
There's no other draw calls or anything like that, renderdoc shows this as the output of the renderpass that uses these 2 shaders. Why are renderdoc and glsl giving me different results to what should be hapenning with the lower right quadrant of the screen?
If anyone ever runs into this, I made a mistake when creating the winding order for my triangles. Some triangles were in the correct winding order, others were not.
The perspective projection "made things work" because it rotated by 180 degrees the image, thus fixing the incorrect winding order.