I am trying to recreate the lessons from Learn OpenGL in Defold. I am trying to simulate element buffers in Defold but I can’t seem to get it right. I am trying to recreate rectangle in this tutorial in Defold. It is coming out wrong and I keep getting an error
rectangle.buffer
[
{
"name": "position",
"type": "float32",
"count": 3,
"data": [-0.5, -0.5, 0.0,
0.5, -0.5, 0.0,
0.5, 0.5, 0.0,
-0.5, 0.5, 0.0]
},
{
"name": "indices",
"type": "uint16",
"count": 1,
"data": [0, 1, 2,
2, 3, 0]
},
{
"name": "color",
"type": "float32",
"count": 4,
"data": [1, 0, 0, 1,
0, 1, 0, 1,
0, 0, 1, 1,
1, 1, 0, 1]
}
]
rectangle.mesh
material: "/materials/rectangle/rectangle.material"
vertices: "/rectangle/rectangle.buffer"
position_stream: "position"
normal_stream: "position"
rectangle.material
name: "rectangle"
tags: "model"
vertex_program: "/materials/rectangle/rectangle.vp"
fragment_program: "/materials/rectangle/rectangle.fp"
vertex_space: VERTEX_SPACE_LOCAL
attributes {
name: "position"
semantic_type: SEMANTIC_TYPE_POSITION
vector_type: VECTOR_TYPE_VEC3
}
attributes {
name: "color"
semantic_type: SEMANTIC_TYPE_COLOR
double_values {
v: 0.0
v: 0.0
v: 0.0
v: 0.0
}
}
attributes {
name: "indices"
data_type: TYPE_UNSIGNED_INT
long_values {
v: 0
}
vector_type: VECTOR_TYPE_SCALAR
}
rectangle.vp
#version 330 core
in vec3 position;
in vec4 color;
out vec4 out_color;
void main()
{
gl_Position = vec4(position, 1.0);
out_color = color;
}
rectangle.fp
#version 330 core
out vec4 FragColor;
in vec4 out_color;
void main()
{
FragColor = out_color;
}
What am I missing?

