Easy3D 2.6.1
|
Management of OpenGL textures. More...
#include <easy3d/renderer/texture_manager.h>
Static Public Member Functions | |
static Texture * | request (const std::string &image_file, Texture::WrapMode wrap=Texture::CLAMP_TO_EDGE, Texture::FilterMode filter=Texture::LINEAR) |
Request a texture from the image file. | |
static Texture * | request (const std::string &image_file, int num_stripes, Texture::WrapMode wrap=Texture::CLAMP_TO_EDGE, Texture::FilterMode filter=Texture::LINEAR) |
Request a texture for rendering scalar fields from a gradually varying (from left to right) color image given its file name. | |
static Texture * | request (int num_stripes, int stride, Texture::WrapMode wrap=Texture::CLAMP_TO_EDGE, Texture::FilterMode filter=Texture::LINEAR) |
Request a random color texture for rendering scalar fields. The texture will have a set of uniformly colored vertical stripes. | |
static void | release (const Texture *texture) |
Release a texture (deallocate its memory). | |
static void | terminate () |
Destroy all textures and release their memory. | |
Management of OpenGL textures.
A texture can be shared by multiple models, so it is wise to have a single instance of a texture. TextureManager manages the texture creation and memories. It ensures no duplication.
|
static |
Release a texture (deallocate its memory).
texture | The texture to be released. |
|
static |
Request a texture for rendering scalar fields from a gradually varying (from left to right) color image given its file name.
This method allows to sample the original image into a specified number of vertical stripes. The generated texture has a unique identifier in the format: "file_name|num_stripes". If a texture with the same identifier is requested again, no new texture will be generated and the existing one is returned.
image_file | The full path to the image file. |
num_stripes | The number of stripes. If num_stripes == image_width, no sampling will occur. |
wrap | The wrap mode. |
filter | The filter mode. |
|
static |
Request a texture from the image file.
The generated texture has a unique identifier of its full-path file name. If a texture with the same identifier is requested again, no new texture will be generated and the existing texture is returned.
image_file | The full path to the image file. |
wrap | The wrap mode. |
filter | The filter mode. |
|
static |
Request a random color texture for rendering scalar fields. The texture will have a set of uniformly colored vertical stripes.
It first generates a random-colored image, where each row has "num_colors" color and each color repeat "stride" times. Then, a texture is created from this image data. The generated texture has a unique identifier in the format: "random|num_stripes|stride", where num_stripes and stride are integer numbers. If the requested number of stripes and the stride match a previously generated texture, no new texture will be generated and the existing texture is returned.
num_stripes | The number of stripes in the texture. |
stride | The width of each vertical strip. So the total width of the texture is: num_stripes * stride. |
wrap | The wrap mode. |
filter | The filter mode. |
|
static |
Destroy all textures and release their memory.