All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
writer.c File Reference

Functions for creating KTX-format files from a set of images. More...

#include <stdio.h>
#include <assert.h>
#include "ktx.h"
#include "ktxint.h"

Functions

KTX_error_code ktxWriteKTXF (FILE *dst, const KTX_texture_info *textureInfo, GLsizei bytesOfKeyValueData, const void *keyValueData, GLuint numImages, KTX_image_info images[])
 Write image(s) in a KTX-formatted stdio FILE stream. More...
 
KTX_error_code ktxWriteKTXN (const char *dstname, const KTX_texture_info *textureInfo, GLsizei bytesOfKeyValueData, const void *keyValueData, GLuint numImages, KTX_image_info images[])
 Write image(s) to a KTX file on disk. More...
 

Detailed Description

Functions for creating KTX-format files from a set of images.

Author
Mark Callow, HI Corporation
Revision:
12050
Date:
2010-07-22 16:05:25 +0900 #

Function Documentation

KTX_error_code ktxWriteKTXF ( FILE *  dst,
const KTX_texture_info textureInfo,
GLsizei  bytesOfKeyValueData,
const void *  keyValueData,
GLuint  numImages,
KTX_image_info  images[] 
)

Write image(s) in a KTX-formatted stdio FILE stream.

Parameters
[in]dstpointer to the FILE stream to write to.
[in]textureInfopointer to a KTX_image_info structure providing information about the images to be included in the KTX file.
[in]bytesOfKeyValueDataspecifies the number of bytes of key-value data.
[in]keyValueDataa pointer to the keyValue data.
[in]numImagesnumber of images in the following array
[in]imagesarray of KTX_image_info providing image size and data.
Returns
KTX_SUCCESS on success, other KTX_* enum values on error.
Exceptions
KTX_INVALID_VALUEdst or target are NULL
KTX_INVALID_VALUEglTypeSize in textureInfo is not 1, 2, or 4 or is different from the size of the type specified in glType.
KTX_INVALID_VALUEpixelWidth in textureInfo is 0 or pixelDepth != 0 && pixelHeight == 0.
KTX_INVALID_VALUEnumberOfFaces != 1 || numberOfFaces != 6 or numberOfArrayElements or numberOfMipmapLevels are < 0.
KTX_INVALID_OPERATIONnumberOfFaces == 6 and images are either not 2D or are not square.
KTX_INVALID_OPERATIONnumber of images is insufficient for the specified number of mipmap levels and faces.
KTX_INVALID_OPERATIONthe size of a provided image is different than that required for the specified width, height or depth or for the mipmap level being processed.
KTX_FILE_WRITE_ERRORa system error occurred while writing the file.
KTX_error_code ktxWriteKTXN ( const char *  dstname,
const KTX_texture_info textureInfo,
GLsizei  bytesOfKeyValueData,
const void *  keyValueData,
GLuint  numImages,
KTX_image_info  images[] 
)

Write image(s) to a KTX file on disk.

Parameters
[in]dstnamepointer to a C string that contains the path of the file to load.
[in]textureInfopointer to a KTX_image_info structure providing information about the images to be included in the KTX file.
[in]bytesOfKeyValueDataspecifies the number of bytes of key-value data.
[in]keyValueDataa pointer to the keyValue data.
[in]numImagesnumber of images in the following array.
[in]imagesarray of KTX_image_info providing image size and data.
Returns
KTX_SUCCESS on success, other KTX_* enum values on error.
Exceptions
KTX_FILE_OPEN_FAILEDunable to open the specified file for writing.

For other exceptions, see ktxWriteKTXF().