This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1258241-3d-graphics-with-metal/lessons/5
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1258241-3d-graphics-with-metal/lessons/5
1 Like
hello Caroline, thanks for the great tutorial. Sorry, it seems like a silly question, but Iām not able to render anything when I use struts instead of float values?
#include <metal_stdlib>
using namespace metal;
struct VertexOut {
float4 position [[ position ]];
float point_size [[ point_size ]];
float3 color;
};
static constant VertexOut verticies[4] = {
{
.position = float4(-0.5, -0.2, 0, 1),
.point_size = 60,
.color = float3(1, 0, 0)
},
{
.position = float4(0.2, -0.2, 0, 1),
.point_size = 60,
.color = float3(0, 1, 0)
},
{
.position = float4(0, 0.5, 0, 1),
.point_size = 60,
.color = float3(0, 0, 1)
}
};
vertex VertexOut vertex_default(uint vertex_id [[ vertex_id ]])
{
return verticies[vertex_id];
}
fragment float4 fragment_default(VertexOut in [[ stage_in ]])
{
return float4(in.color, 1);
}
@borisdering - What does your draw call in Renderer say? Are you rendering the correct number of vertices?