Use indexed drawing
This commit is contained in:
1 parent
6d8fdb2f8c
commit
c770895217
3 files changed
+102
-38
No files matched your search
@@ -4,11 +4,14 @@
|
||||
#include <math.h>
|
||||
|
||||
static const vertex_t vertices[] = {
|
||||
{ { 0.0, -0.5 }, { 1.0, 0.0, 0.0 } },
|
||||
{ { 0.5, 0.5 }, { 0.0, 1.0, 0.0 } },
|
||||
{ { -0.5, 0.5 }, { 0.0, 0.0, 1.0 } },
|
||||
{ { -0.5, -0.5 }, { 1.0, 0.0, 0.0 } },
|
||||
{ { 0.5, -0.5 }, { 0.0, 1.0, 0.0 } },
|
||||
{ { 0.5, 0.5 }, { 0.0, 0.0, 1.0 } },
|
||||
{ { -0.5, 0.5 }, { 1.0, 1.0, 1.0 } },
|
||||
};
|
||||
|
||||
static const uint16_t indices[] = { 0, 1, 2, 2, 3, 0 };
|
||||
|
||||
static void
|
||||
key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
@@ -42,6 +45,8 @@ int main()
|
||||
.window = window,
|
||||
.vertex_data = vertices,
|
||||
.vertex_data_size = sizeof(vertices),
|
||||
.index_data = indices,
|
||||
.index_data_size = sizeof(indices),
|
||||
};
|
||||
gpu_ctx_t gpu;
|
||||
gpu_init(&gpu, &gpu_config);
|
||||
|
||||
Reference in new issue
Block a user