Skip to content

Converts 3D OBJ files to vector and texture coordinates to plot in OpenGL with glDrawArrays. Written in Python.

Notifications You must be signed in to change notification settings

kohterai/OBJ-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

.OBJ-Parser

OBJ file parser written in Python. Converts OBJ files to vector and texture coordinates to plot in OpenGL with glDrawArrays.

Example .obj file format

The Parser currently only examines lines that begin with "v" (vertex), "vt" (vertex texture), and "f" (faces). Furthermore the faces should consist of the standard .obj format of v/vt/n/... where the values are separated by slashes.
v -0.257682 -1.674006 0.731635
v -0.132727 -1.662367 0.777859
v -0.467796 -1.580605 0.795138

vt 0.336677 0.109069
vt 0.323670 0.086280
vt 0.333450 0.154337

f 1/1/1 5/2/2 6/3/3 2/4/4
f 2/4/4 6/3/3 2/5/5 1/6/6
f 5/2/2 6/7/7 4/8/8 6/3/3

The code is currently optimized for quaderateral faces. Given faces f=[0, 1, 2, 3] the parser will return appropiate vertex and texture coordinates for the two triangles [0, 1, 2] and [0, 2, 3].

Output

Two files are produced. The first file conists of the vertex coordinates and the second file the texture coordinates. The terminal prints the total number of vertices for explicitly allocating array memory.

About

Converts 3D OBJ files to vector and texture coordinates to plot in OpenGL with glDrawArrays. Written in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages