Applying a bitmap image to a texture

Applying a bitmap image to a texture

Anonymous
Not applicable
610 Views
3 Replies
Message 1 of 4

Applying a bitmap image to a texture

Anonymous
Not applicable
Hi

I am using the following code in a SceneImport plugin.


BitMapTex* theTex= NewDefaultBitmapTex();
BitmapInfo bi;
Bitmap* bmap;
bi.SetName(longFileName);
bmap= TheManager->Load(&bi);
theTex->SetBitmapInfo(bi); //set Bitmap info first
theTex->SetBitmap(bmap);




Subsequently this texture is applied to a material. The appropriate bitmaps are initially visible on the scene materials in the material editor (as well as on the imported model when I use the "Standard display with maps" option on the menu), but the "view image" button in the material editor does nothing. And if I click "Reload" the texture disappears. It's obvious one or more extra function calls are missing; what could they be?

Btw I could have skipped creating a Bitmap and BitmapInfo and just used "SetMapName". Works fine at times but this occasionally causes crashes (probably because of invalid Bitmap* pointer).
0 Likes
611 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
hi, did you solve this problem? I am encountering the problem
0 Likes
Message 3 of 4

Anonymous
Not applicable
ok,the problem is solved,
....
do not use setbitmap(), it is no use, u should use SetMapName(filePath);that's work, render in 3ds Max, you will see the bitmap
0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks you for this topic. But I have problem with bitmap creating. TheManager->Load returns null, LoadInto has fail result. So I don't know. It should be so easy to create bitmap from png texture and set in to material. I working on it few days in row. But 3ds max API is the WORST API I ever seen. 

Maybe you still have you code with this functional? 

 

0 Likes