tinyobjloader | Tiny but powerful single file wavefront obj loader | Graphics library
kandi X-RAY | tinyobjloader Summary
kandi X-RAY | tinyobjloader Summary
Tiny but powerful single file wavefront obj loader written in C++03. No dependency except for C++ STL. It can parse over 10M polygons with moderate memory and time. tinyobjloader is good for embedding .obj loader to your (global illumination) renderer ;-). If you are looking for C89 version, please see .
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of tinyobjloader
tinyobjloader Key Features
tinyobjloader Examples and Code Snippets
Community Discussions
Trending Discussions on tinyobjloader
QUESTION
I am trying to draw this free airwing model from Starfox 64 in OpenGL. I converted the .fbx file to .obj in Blender and am using tinyobjloader to load it (all requirements for my university subject).
I pretty much slapped the example code (with the modern API) into my program, replaced the file name, and grabbed the attrib.vertices
and attrib.normals
vectors to draw the airwing.
I can view the vertices with GL_POINTS:
...ANSWER
Answered 2021-May-25 at 17:48E: When I wrote this answer originally I had only worked with vertices and normals. I've figured out how to get materials and textures working, but don't have time to write that out at the moment. I will add that in when I have some time, but it's largely the same logic if you wanna poke around the tinyobj header yourselves in the meantime. :-)
I've learned a lot about TinyOBJLoader in the last day so I hope this helps someone in the future. Credit goes to this GitHub repository which uses TinyOBJLoader very clearly and cleanly in fileloader.cpp
.
To summarise what I learned studying that code:
Shapes are of type shape_t
. For a single model OBJ, the size of shapes
is 1. I'm assuming OBJ files can contain multiple objects but I haven't used the file format much to know.
shape_t
's have a member mesh
of type mesh_t
. This member stores the information parsed from the face rows of the OBJ. You can figure out the number of faces your object has by checking the size of the material_ids
member.
The vertex, texture coordinate and normal indices of each face are stored in the indices
member of the mesh. This is of type std::vector
. This is a flattened vector of indices. So for a model with triangulated faces f1, f2 ... fi
, it stores v1, t1, n1, v2, t2, n2 ... vi, ti, ni
. Remember that these indices correspond to the whole vertex, texture coordinate or normal. Personally I triangulated my model by importing into Blender and exporting it with triangulation turned on. TinyOBJ has its own triangulation algorithm you can turn on by setting the reader_config.triangulate
flag.
I've only worked with the vertices and normals so far. Here's how I access and store them to be used in OpenGL:
- Convert the flat vertices and normal arrays into groups of 3, i.e. 3D vectors
QUESTION
I followed this guide to create a very basic Vulkan program, and for some reason, even when completely copying the code from the guide (and not using my own version which is slightly different and modified to my needs) I still receive the following two validation layer errors upon starting the program:
...ANSWER
Answered 2020-Sep-06 at 07:16Those errors aren't triggered by your application, but rather by implicit layers installed by OBS Studio. Applications can register their own implicit layers globally, and these are then loaded as soon as you run a Vulkan application. If one of those layers is flawed, you'll get validation layer errors in your own application, even if your application is perfectly fine.
The easiest way to disable these is the recently released Vulkan Configurator from the LunarG SDK. Without the SDK you can disable implicit layers by setting their value to 1
in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\ImplicitLayers
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tinyobjloader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page