diff options
| author | DrNuget <drnuget@outlook.com> | 2026-01-04 22:12:24 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2026-01-04 22:12:24 +0200 |
| commit | 510f1bac9b71ba240d30bb5bc5df6501e70fafc9 (patch) | |
| tree | 7bc48763071a8c315b82e638a267411c3453dd09 /src/cube.c | |
| download | opengl-test-510f1bac9b71ba240d30bb5bc5df6501e70fafc9.tar.gz | |
Working 3D with .obj file loading
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/cube.c b/src/cube.c new file mode 100644 index 0000000..66723ac --- /dev/null +++ b/src/cube.c @@ -0,0 +1,39 @@ +#include "cube.h" + +ViewModel createCube() +{ + float vertices[] = { + 1.0f, 1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f + }; + unsigned int indices[] = { + 0, 1, 2, + 0, 2, 3, + + 4, 5, 6, + 4, 6, 7, + + 0, 4, 5, + 2, 6, 3, + + 3, 7, 6, + 1, 5, 0, + + 3, 7, 0, + 0, 4, 7, + + 2, 6, 1, + 1, 5, 6 + }; + + ViewModel model; + createViewModel(&model, 8, vertices, 38, indices); + return model; +} |
