https://github.com/macdue/simpleobjloader
A very simple Wavefront .obj loader with glut support.
https://github.com/macdue/simpleobjloader
c comp27112 glut opengl single-header single-header-lib wavefront-obj
Last synced: about 2 months ago
JSON representation
A very simple Wavefront .obj loader with glut support.
- Host: GitHub
- URL: https://github.com/macdue/simpleobjloader
- Owner: MacDue
- License: unlicense
- Created: 2018-02-15T10:02:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T19:02:29.000Z (about 7 years ago)
- Last Synced: 2025-03-25T01:36:39.158Z (2 months ago)
- Topics: c, comp27112, glut, opengl, single-header, single-header-lib, wavefront-obj
- Language: C
- Homepage:
- Size: 17.6 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Simple Obj Loader
#### A really simple single header Wavefront .obj loader with glut support.Including:
```c
// Only needed at first include
#define SIMPLE_OBJ_IMP
// glut needs to be included first for drawObj implementation
#include
#include "simple_obj.h"
```##### Full docs:
Usage:```c
// Loading a .obj
SimpleObj_t* myObj = loadObj("some_model.obj");
```Drawing:
```c
// GL setup stuff, transforms, ect...
drawObj(myObj);
// More GL stuff
```Groups:
```c
// Access the struct for the first group in the file.
ObjGroup_t* group = objDataArrayAccess(&myObj->groups, 0);
// Attributes: name, startFace, endFace, & render.
group->render = false; // don't draw this group.
```Freeing obj data:
```c
// This obj is trash
disposeObj(myObj);
// It's where it belongs now
```Working:
- Vertices
- Normals
- Texture coords
- Faces
- Basic renderingTodo:
- ~~Separate group rendering~~ (done)
- Materials
- Maybe support some more obj features
- ~~Clean up and free stuff~~ (done)##### Example result:
