Creating a texture object for a texture file
 
 
 

The following code from the CubeCreator tutorial program shows how to create a texture object and to set some of its properties so that it refers to a texture file, crate.jpg:

KFbxTexture* gTexture = NULL;
...
// Create a global texture for cube.
void CreateTexture(KFbxSdkManager* pSdkManager)
{
    gTexture = KFbxTexture::Create(pSdkManager,"Diffuse Texture");
    // Resource file must be in the application’s directory.
    KString lTexPath = gAppPath + "\\Crate.jpg";
    // Set texture properties.
    gTexture->SetFileName(lTexPath.Buffer());
    gTexture->SetTextureUse(KFbxTexture::eSTANDARD);
    gTexture->SetMappingType(KFbxTexture::eUV);
    gTexture->SetMaterialUse(KFbxTexture::eMODEL_MATERIAL);
    gTexture->SetSwapUV(false);
    gTexture->SetTranslation(0.0, 0.0);
    gTexture->SetScale(1.0, 1.0);
    gTexture->SetRotation(0.0, 0.0);
}
NoteThe texture file crate.jpg must be available to CubeCreator at run time, and available to the renderer (e.g., FBX for QuickTime) of the file exported by CubeCreator. See: