How can I save a image file from one format to another in TorqueScript?
by Vince Gee · in Torque 3D Professional · 10/10/2013 (5:22 am) · 3 replies
Lets say I have a DDS for a texture and I want to export it as a BMP(or any other format) and save it. Does anyone know how to do this via TorqueScript or C++? I want the ability to allow people to export stuff to different formats.
Vince
Vince
About the author
www.winterleafentertainment.com
#2
The getBitMap() function is returning null... why?
10/10/2013 (7:12 am)
Ok, did some more digging,//GFXTextureProfile* profile;
BitStream* tempStream = BitStream::getPacketStream(4294967295);
GFXTexHandle* mTextureObject = new GFXTexHandle("art/terrains/Example/Empty Terrain_0_basetex",&GFXDefaultGUIProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
GBitmap* bm = mTextureObject->getBitmap();
mTextureObject->getBitmap()->writeBitmap("BMP",*tempStream);
delete mTextureObject;
delete tempStream;The getBitMap() function is returning null... why?
#3
Is the texture stored in system memory? Look at its profile, and change it if needed. I *think* GFXDefaultGUIProfile only stores the texture in video RAM, though it's like 4 years since I checked.
10/10/2013 (7:14 am)
Hi Vince,Is the texture stored in system memory? Look at its profile, and change it if needed. I *think* GFXDefaultGUIProfile only stores the texture in video RAM, though it's like 4 years since I checked.
Torque Owner Vince Gee
WinterLeaf Entertainment
extern "C" __declspec(dllexport) void __cdecl TestFileExport() { //GFXTextureProfile* profile; BitStream* tempStream = BitStream::getPacketStream(4294967295); GFXTexHandle* mTextureObject = new GFXTexHandle("art/terrains/Example/Empty Terrain_0_basetex",&GFXDefaultGUIProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__)); mTextureObject->getBitmap()->writeBitmap("JPG",*tempStream); delete mTextureObject; delete tempStream; }I'm working until I hit the "writeBitMap" command.
and it blows up at
GFXFormat getFormat() const { return mInternalFormat; }