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

Fix loading of NPOT textures, support loading raw volumes from blob #680

Merged
merged 2 commits into from
Jan 28, 2019

Conversation

tribal-tec
Copy link
Contributor

No description provided.

Do not use FreeImage_GetBits() as this does not return the real raw pixels that
we expect.
const auto pitch = FreeImage_GetPitch(image.get());
const auto channels = 4;

std::vector<unsigned char> rawData(height * pitch);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Shouldn't it be height * pitch * channels?

Copy link
Contributor Author

@tribal-tec tribal-tec Jan 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is correct. bytesPerPixel would be needed if we would load float textures or something similar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact I was not talking about the bytes per Pixel, but the number of channels. But if you tell me that pitch is in bytes and not number of elements, that would explain why this code works (and would always do regardless of channels and bytes per pixel).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what apparently the pitch in FreeImage is, yes.

@tribal-tec tribal-tec requested a review from karjonas January 28, 2019 13:54
@tribal-tec tribal-tec merged commit 6cf2a12 into BlueBrain:master Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants