I’m rendering 8 points in a cube, and not sorting the vertices yet. Fragments are discarded even though depth test is disabled. What else might cause the fragments to be discarded?
Screenshots:
https://imgur.com/a/lnhnJ
The relevant bits of code:
const std::vector<vertexStruct> vertices = {
{{-0.5f, -0.5f, 0.0f}, {1.0f, 0.0f, 0.0f}},
{{0.5f, -0.5f, 0.0f}, {0.0f, 1.0f, 0.0f}},
{{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, 1.0f}},
{{-0.5f, 0.5f, 0.0f}, {1.0f, 1.0f, 1.0f}},
{{-0.5f, -0.5f, -0.5f}, {1.0f, 0.0f, 0.0f}},
{{0.5f, -0.5f, -0.5f}, {0.0f, 1.0f, 0.0f}},
{{0.5f, 0.5f, -0.5f}, {0.0f, 0.0f, 1.0f}},
{{-0.5f, 0.5f, -0.5f}, {1.0f, 1.0f, 1.0f}}};
...
a.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
r.polygonMode = VK_POLYGON_MODE_FILL;
r.cullMode = VK_CULL_MODE_NONE;
d.depthTestEnable = VK_FALSE;
d.depthBoundsTestEnable = VK_FALSE;
d.stencilTestEnable = VK_FALSE;
...
blend.blendEnable = VK_TRUE;
blend.colorBlendOp = VK_BLEND_OP_ADD;
blend.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
blend.dstColorBlendFactor = VK_BLEND_FACTOR_ONE;
blend.alphaBlendOp = VK_BLEND_OP_ADD;
blend.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
blend.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
...
#version 450
#extension GL_ARB_separate_shader_objects : enable
out gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
};
layout(location = 0) out vec3 fragColor;
layout(binding = 0) uniform UniformBufferObject {
mat4 modelview;
mat4 proj;
} ubo;
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inColor;
void main() {
gl_Position = ubo.proj * ubo.modelview * vec4(inPosition, 1.0);
gl_PointSize = 40;
fragColor = inColor;
}
...
#version 450
#extension GL_ARB_separate_shader_objects : enable
layout(location = 0) out vec4 outColor;
layout(location = 0) in vec3 fragColor;
void main() {
vec2 c = gl_PointCoord - 0.5;
float a = clamp(1.2 - sqrt(dot(c, c))*2.4, 0, 1);
outColor = vec4(fragColor*a, a);
}