Comments (3)
Not really sure, but you might get something like that if you passed GL_UNSIGNED_SHORT
to glDrawElements
rather than GL_UNSIGNED_INT
. fastObjMesh::positions[0]
is a vertex at (0, 0, 0) - all valid indices are 1 based so it's never actually referenced, but if you got the size wrong to the glDrawElements
call GL would see lots of 0 indices and might give you something like you describe. Hopefully give you something to look for anyway...
from fast_obj.
Had another crack at it, no luck so far. Here is a more complete snippet, I hope it helps since my last one was really minimal
Initialization:
fastObjMesh* objmesh = fast_obj_read(path);
if (objmesh == NULL) {
printf("Error loading OBJ file with path: %s\n", path);
return;
}
mesh->count = objmesh->index_count;
glGenVertexArrays(1, &mesh->VAO);
glBindVertexArray(mesh->VAO);
glGenBuffers(1, &mesh->VBO);
glBindBuffer(GL_ARRAY_BUFFER, mesh->VBO);
glBufferData(GL_ARRAY_BUFFER, objmesh->position_count * sizeof(float) * 3, objmesh->positions, GL_STATIC_DRAW);
glGenBuffers(1, &mesh->EBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, objmesh->index_count * sizeof(unsigned int), objmesh->indices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
Draw loop:
glBindVertexArray(mesh->VAO);
glDrawElements(GL_TRIANGLES, mesh->count, GL_UNSIGNED_INT, 0);
from fast_obj.
Sorry, wrote my own loader to test. Exact same result, not an issue with the library. Will edit this comment when I find a fix
from fast_obj.
Related Issues (20)
- Support for line continuations
- Performance Ideas: 2 pass ? HOT 4
- Adds a .clang-format at project root ?
- dummy data HOT 2
- Versionning in file header HOT 3
- Support both Unix and Windows style paths HOT 2
- obj writer HOT 2
- Including in another CMake build system project via ExternalProject HOT 2
- Capital vs non-capital
- Potential Security Issue HOT 2
- Support Vertex Color OBJ Format HOT 3
- Allow certain vertex attributes to be skipped
- Possible memory leak when calling fast_obj_read_with_callbacks() HOT 2
- Memory leak HOT 2
- bug - off by one HOT 1
- We ported FastObj to Unity HOT 2
- Infinite loop / crash with invalid input
- Maybe an option to not skip empty objects?
- Would it make sense to unify materials/vertices/indices arrays? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast_obj.