I am creating a bitmap and setting it as the diffuse map for an object.
I used Bitmap and BitmapInfo classes to create the bitmap from an image buffer. the bitmap is saved to a file and this bitmapInfo is used to set diffuse map of the object.
But I need to support RGB888 format without alpha.
Now I could support only RGBA8888 format.
How is it possible to create Bitmap with only RGB channels in 3ds max sdk?
the code snippet currently used is given below.
//creating BitmapInfo
BitmapInfo bi;
bi.SetType( BMM_TRUE_32 );
bi.SetFlags( MAP_HAS_ALPHA );
bi.SetWidth( (WORD)width);
bi.SetHeight( (WORD)height);
bi.SetCustomFlag( 0 );
bi.SetPath(filename);
Bitmap cust_bmap;
cust_bmap = TheManager->Create(&bi);
for(int i=0;i<height;i++)
{
std::vector<BMM_Color_fl> pixelscheck( width );
//fill pixelscheck for each row
cust_bmap->PutPixels( 0, i, width , &pixelscheck[0] )
}
FILE* file = _wfopen(filename,_T("wb"));
if (!file)
{
return ;
}
cust_bmap->OpenOutput(&bi);
cust_bmap->Write(&bi, BMM_SINGLEFRAME);
cust_bmap->Close(&bi);
fclose(file);
//apply it to BitmapTex
bitmaptex->SetMap(bi.GetAsset());