In my tutorial for study Metal , I want to draw the points in view,
I can now present in view of the square points, but I can not draw of round points.
how can I do ?
i have set Shaders.metal:
struct VertexOut {
float4 position [[position]];
float pointSize [[point_size]];
};
struct Uniforms {
float4x4 ncdMatrix;
float ptmRatio;
float pointSize;
};
vertex VertexOut polipoint_vertex(const device packed_float3* vertex_array [[buffer(2)]],
const device Uniforms& uniforms [[buffer(3)]],
unsigned int vid [[vertex_id]])
{
VertexOut vertexOut;
float3 position = vertex_array[vid];
vertexOut.position = float4(position.x , position.y , 0 , 1);
vertexOut.pointSize = uniforms.pointSize;
return vertexOut;
}set drawInMTKView:
let commandEncoder3 = commandEncoder.renderCommandEncoder()
commandEncoder3.setRenderPipelineState(pipelinePointState)
commandEncoder3.setVertexBuffer(vertexPointBuffer, offset: 0, atIndex: 2)
commandEncoder3.setVertexBuffer(uniformBuffer, offset: 0, atIndex: 3)
commandEncoder3.drawPrimitives(.Point, vertexStart: 0, vertexCount: 2, instanceCount: 1)
commandEncoder3.endEncoding()how set Metal for return a round point with position and pointSize ?
Help me please ?