Search code examples
renderingvulkan

How to draw a round point in vulkan?


I'm able to render a point in vulkan by specifying VK_PRIMITIVE_TOPOLOGY_POINT_LIST in the graphics pipeline. But the resulting point is a small square.

How can I draw a round point in Vulkan? Is there an equivalent to GL_SMOOTH_POINT?


Solution

  • As noted in the comments, there is no such functionality built-into Vulkan.

    But you can easily emulate this in your point list rendering fragment shader by discarding fragments outside of a given circular radius like this:

    const float radius = 0.25;
    if (length(gl_PointCoord - vec2(0.5)) > radius) {
        discard;
    }