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

Missing documentation #53

Open
alexpanter opened this issue Apr 16, 2022 · 1 comment
Open

Missing documentation #53

alexpanter opened this issue Apr 16, 2022 · 1 comment
Assignees

Comments

@alexpanter
Copy link

Hi,

Really nice to see initiative to continue development on the (actually widely used) SOIL library!

For the below function:

SOIL_load_OGL_HDR_texture
	(
		const char *filename,
		int fake_HDR_format,
		int rescale_to_max,
		unsigned int reuse_texture_ID,
		unsigned int flags
	);

the parameter rescale_to_max seems undocumented. Looking through the code it seems to be used for the formats that are alpha-premultipied (ie not RGBE). What I could find is this:

// image_helper.c
int RGBE_to_RGBdivA(...)
{
    /* convert (note: no negative numbers, but 0.0 is possible) */
    if( rescale_to_max )
	{
		scale = 255.0f / find_max_RGBE( image, width, height );
	}
}
[...]
int RGBE_to_RGBdivA2(...)
{
    /* convert (note: no negative numbers, but 0.0 is possible) */
    if( rescale_to_max )
	{
		scale = 255.0f * 255.0f / find_max_RGBE( image, width, height );
	}
}

I'm not really sure what it means, but it seems to me like rescale_to_max is intended as a boolean flag to somehow rescale the image by its maximum luminance, or something different...

Would it be possible to give a clarification for this, and possible also some documentation to the SOIL_load_OGL_HDR_texture interface?

Thanks! :)

@SpartanJ SpartanJ self-assigned this Apr 17, 2022
@SpartanJ
Copy link
Owner

This is something that wasn't documented in the original SOIL version. I'm actually not sure what's supposed to do, but it looks exactly what you're interpreting from the code, it looks that rescales the image colors to their maximum luminance when converting it from RGBE. I prefer not to document it unless I'm sure what's doing.

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

No branches or pull requests

2 participants