Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgltf_image::buffer_view::data is null #183

Open
Trider12 opened this issue Jul 6, 2022 · 2 comments
Open

cgltf_image::buffer_view::data is null #183

Trider12 opened this issue Jul 6, 2022 · 2 comments
Assignees

Comments

@Trider12
Copy link

Trider12 commented Jul 6, 2022

I'm loading some glb files and cgltf_image::buffer_view::data is null:

image

I'm able to get the data by doing:

void* data = texture->image->buffer_view->buffer->data + texture->image->buffer_view->offset;

But this feels like not the intended way of doing this.

@jkuhlmann
Copy link
Owner

There is actually a comment in the definition of cgltf_buffer_view about this:

	void* data; /* overrides buffer->data if present, filled by extensions */

And then there is a helper function which does exactly what you are doing: cgltf_buffer_view_data(). It doesn't seem to be exposed externally though. Maybe we should do that. It would help you, correct?

@jkuhlmann jkuhlmann self-assigned this Jul 6, 2022
@Trider12
Copy link
Author

Trider12 commented Jul 6, 2022

Ah, I saw that comment, but still miss-interpreted the purpose of the cgltf_buffer_view::data field. I feel that the naming is a bit confusing, but understand that altering it is a breaking change, so is not possible.

But I did actually end up writing a function identical to cgltf_buffer_view_data() myself, so maybe exposing it is a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants