{"id":16856439,"url":"https://github.com/vallentin/loadobj","last_synced_at":"2025-03-18T11:14:20.416Z","repository":{"id":89082118,"uuid":"64508326","full_name":"vallentin/LoadOBJ","owner":"vallentin","description":null,"archived":false,"fork":false,"pushed_at":"2018-12-05T22:56:20.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T17:34:57.399Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vallentin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-29T20:24:14.000Z","updated_at":"2018-12-05T22:56:22.000Z","dependencies_parsed_at":"2023-06-13T21:09:19.937Z","dependency_job_id":null,"html_url":"https://github.com/vallentin/LoadOBJ","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLoadOBJ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLoadOBJ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLoadOBJ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLoadOBJ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vallentin","download_url":"https://codeload.github.com/vallentin/LoadOBJ/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244207746,"owners_count":20416109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T14:04:14.905Z","updated_at":"2025-03-18T11:14:20.411Z","avatar_url":"https://github.com/vallentin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# LoadOBJ\n\nLoadOBJ is a minimal single-header OBJ loader written in C.\n\n\n## Example\n\n```c\nLoadOBJMesh mesh;\nloadOBJ(\u0026mesh, ...);\n\nLoadOBJTriangleMesh trimesh;\nloadOBJTriangulate(\u0026trimesh, \u0026mesh);\n\nloadOBJDestroyMesh(\u0026mesh);\nloadOBJDestroyTriangleMesh(\u0026trimesh);\n```\n\n\n## Implementation\n\nIn one C or C++ file, define `LOADOBJ_IMPLEMENTATION` prior to inclusion to create the implementation.\n\n```c\n#define LOADOBJ_IMPLEMENTATION\n#include \"loadobj.h\"\n```\n\n\n## OpenGL Example\n\n```c\n#include \u003cstddef.h\u003e // offsetof\n\n// Load OBJ\n\nLoadOBJMesh mesh;\nloadOBJ(\u0026mesh, ...);\n\nLoadOBJTriangleMesh trimesh;\nloadOBJTriangulate(\u0026trimesh, \u0026mesh);\n\nloadOBJDestroyMesh(\u0026mesh);\n\n// Setup Vertex Buffer and Vertex Arrays\n\nconst GLsizei vertexCount = trimesh.vertexCount;\n\nGLuint vao, vbo;\n\nglGenVertexArrays(1, \u0026vao);\nglBindVertexArray(vao);\n\nglCreateBuffers(1, \u0026vbo);\nglBindBuffer(GL_ARRAY_BUFFER, vbo);\nglBufferData(GL_ARRAY_BUFFER, vertexCount * sizeof(LoadOBJTriangleVertex), trimesh.vertices, GL_STATIC_DRAW);\n\nglEnableVertexAttribArray(ATTRIBUTE_POSITION);\nglVertexAttribPointer(ATTRIBUTE_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(LoadOBJTriangleVertex), (const GLvoid*) offsetof(LoadOBJTriangleVertex, x));\n\nglEnableVertexAttribArray(ATTRIBUTE_TEXCOORD);\nglVertexAttribPointer(ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(LoadOBJTriangleVertex), (const GLvoid*) offsetof(LoadOBJTriangleVertex, u));\n\nglEnableVertexAttribArray(ATTRIBUTE_NORMAL);\nglVertexAttribPointer(ATTRIBUTE_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(LoadOBJTriangleVertex), (const GLvoid*) offsetof(LoadOBJTriangleVertex, nx));\n\nloadOBJDestroyTriangleMesh(\u0026trimesh);\n\n// Draw\n\nglDrawArrays(GL_TRIANGLES, 0, vertexCount);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Floadobj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvallentin%2Floadobj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Floadobj/lists"}