MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxTexture2_CreateFromNamedFile

Function ktxTexture2_CreateFromNamedFile

lib/texture2.c:1461–1483  ·  view source on GitHub ↗

* @memberof ktxTexture2 * @~English * @brief Create a ktxTexture2 from a named KTX file. * * The address of a newly created ktxTexture2 reflecting the contents of the * file is written to the location pointed at by @p newTex. * * The file name must be encoded in utf-8. On Windows convert unicode names * to utf-8 with @c WideCharToMultiByte(CP_UTF8, ...) before calling. * * The create fla

Source from the content-addressed store, hash-verified

1459 * For other exceptions, see ktxTexture2_CreateFromStdioStream().
1460 */
1461KTX_error_code
1462ktxTexture2_CreateFromNamedFile(const char* const filename,
1463 ktxTextureCreateFlags createFlags,
1464 ktxTexture2** newTex)
1465{
1466 KTX_error_code result;
1467
1468 if (newTex == NULL)
1469 return KTX_INVALID_VALUE;
1470
1471 ktxTexture2* tex = (ktxTexture2*)malloc(sizeof(ktxTexture2));
1472 if (tex == NULL)
1473 return KTX_OUT_OF_MEMORY;
1474
1475 result = ktxTexture2_constructFromNamedFile(tex, filename, createFlags);
1476 if (result == KTX_SUCCESS)
1477 *newTex = (ktxTexture2*)tex;
1478 else {
1479 free(tex);
1480 *newTex = NULL;
1481 }
1482 return result;
1483}
1484
1485/**
1486 * @memberof ktxTexture2

Callers 2

TESTFunction · 0.85

Calls 1

Tested by 1

TESTFunction · 0.68