Sorry man, don't think it will compile if the diff is correct.
{
int actual_channels = 0;
// num_channels forces the number of channels in the returned data
// so channels_in_file can be safely ingnored
unsigned char *image_data =
stbi_load_from_memory(reinterpret_cast<const unsigned char*>(data_in.data()),
data_in.size(),
&width,
&height,
&actual_channels, /// Removed
&channels_in_file, /// Added
num_channels);
if (image_data)
channels_in_file is undefined, you still have ...
int actual_channels = 0;
But it's still before the caffeine has kicked in
The problem is this line of code
const int texture_width = textures[0]->w();
You then go on to assert
if textures[i]->w() != texture_width
.
Effectively
if (textures[0]->w() != textures[i]->w() )
Forcing all textures in the array to be the same size.
This may or may not be true depending on the usage.