hello ,
I am trying to write an auto generated image to disk.
I can succesfully create the file but they are all black and only 1kb (256x256) - which is ofc wrong.
here my code
PNMImage* pPNMImage = new PNMImage(256, 256, 4);
for (int y = 0; y < 256; y++)
{
for (int x = 0; x < 256; x++)
{
pPNMImage->set_red_val(x, y, redValue );
pPNMImage->set_green_val(x, y, greenValue);
pPNMImage->set_blue_val(x, y, blueValue);
pPNMImage->set_alpha_val(x, y, 1.0f);
}
}
PT(Texture) pTex = new Texture();
pTex->load(*pPNMImage);
pTex->set_magfilter(Texture::FT_nearest);
pTex->set_minfilter(Texture::FT_linear_mipmap_linear);
pTex->set_wrap_u(Texture::WM_repeat);
pTex->set_wrap_v(Texture::WM_repeat);
pTex->set_wrap_w(Texture::WM_repeat);
bool a = pTex->write(Filename("NewTex.png"));
bool b = pPNMImage->write(Filename("NewPNMImage.png"));
delete pPNMImage;
am I missing something ?