HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
(make_texture -- Turn an image into a texture)

Functions

bool OIIO_API ImageBufAlgo::make_texture (MakeTextureMode mode, const ImageBuf &input, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 Version of make_texture that starts with an ImageBuf. More...
 
bool OIIO_API ImageBufAlgo::make_texture (MakeTextureMode mode, string_view filename, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 
bool OIIO_API ImageBufAlgo::make_texture (MakeTextureMode mode, const std::vector< std::string > &filenames, string_view outputfilename, const ImageSpec &config, std::ostream *outstream=nullptr)
 

Detailed Description

The make_texture() function turns an image into a tiled, MIP-mapped, texture file and write it to disk (outputfilename).

The return value is true for success, false if an error occurred. If there was an error, any error message will be retrievable via the global OIIO::geterror() call (since there is no destination ImageBuf in which to store it).

Named fields in config:

Metadata in config.extra_attribs

Parameters
modeDescribes what type of texture file we are creating and may be one of:
  • MakeTxTexture : Ordinary 2D texture.
  • MakeTxEnvLatl : Latitude-longitude environment map
  • MakeTxEnvLatlFromLightProbe : Latitude-longitude environment map constructed from a "light probe" image.
  • MakeTxBumpWithSlopes : Bump/displacement map with extra slope data channels (6 channels total, containing both the height and 1st and 2nd moments of slope distributions) for bump-to-roughness conversion in shaders.
outputfilenameName of the file in which to save the resulting texture.
configAn ImageSpec that contains all the information and special instructions for making the texture. Anything set in config (format, tile size, or named metadata) will take precedence over whatever is specified by the input file itself. Additionally, named metadata that starts with "maketx:" will not be output to the file itself, but may contain instructions controlling how the texture is created. The full list of supported configuration options is listed below.
outstreamIf not nullptr, it should point to a stream (for example, &std::out, or a pointer to a local std::stringstream to capture output), which is where console output and errors will be deposited. Note that error messages will also be retrievable from OIIO::geterror().

Function Documentation

bool OIIO_API ImageBufAlgo::make_texture ( MakeTextureMode  mode,
const ImageBuf input,
string_view  outputfilename,
const ImageSpec config,
std::ostream *  outstream = nullptr 
)

Version of make_texture that starts with an ImageBuf.

bool OIIO_API ImageBufAlgo::make_texture ( MakeTextureMode  mode,
string_view  filename,
string_view  outputfilename,
const ImageSpec config,
std::ostream *  outstream = nullptr 
)

Version of make_texture that starts with a filename and reads the input from that file, rather than being given an ImageBuf directly.

bool OIIO_API ImageBufAlgo::make_texture ( MakeTextureMode  mode,
const std::vector< std::string > &  filenames,
string_view  outputfilename,
const ImageSpec config,
std::ostream *  outstream = nullptr 
)

Version of make_texture that takes multiple filenames (reserved for future expansion, such as assembling several faces into a cube map).