#include <texture_texture3D.h>
Public Member Functions | |
unsigned int | get_texture_ID () const |
unsigned int | get_texture_target () const |
int | width () const |
int | height () const |
int | depth () const |
int | get_internal_format () const |
bool | cubic () const |
float | unpack_scale () const |
int | check_texture_size (int internal_format, int width, int height, int depth, int external_format, int external_type) |
Texture3D (int internal_format, int image_width, int image_height, int image_depth, int format, int type, const void *pixels, bool cubic=false, float unpack_scale=1.0) | |
Texture3D (int internal_format, int texture_size_i, int texture_size_j, int texture_size_k, int format, int type, bool cubic=false, float unpack_scale=1.0) | |
~Texture3D () | |
void | bind () const |
template<typename T > | |
void | load_sub_image_into_texture (int image_skip_i, int image_skip_j, int image_skip_k, int image_size_i, int image_size_j, int image_size_k, int texture_offset_i, int texture_offset_j, int texture_offset_k, int texture_fill_i, int texture_fill_j, int texture_fill_k, T const *pixels) |
template<typename T > | |
void | load (T const *pixels) |
void | set_repeating (bool flag) |
bool | is_valid_sampler_type (std::string const &sampler_type) const |
Protected Member Functions | |
void | create (unsigned int texture_ID=0) |
void | setup_pixel_transfer () |
void | clear_pixel_transfer () |
Protected Attributes | |
GLuint | m_texture_ID |
The ID of the texture object. | |
int | m_internal_format |
The internal format of the texture, i.e. how many color compoents (and their size). | |
bool | m_owned |
Boolean flag indicating whether this texture instance owns the texture object. | |
int | m_image_skip_i |
The pixel offset in an image row, from where to start loading pixel data. | |
int | m_image_skip_j |
The row offset in an image, from where to start loading pixel data. | |
int | m_image_skip_k |
The image offset in an volume, from where to start loading pixel data. | |
int | m_image_size_i |
The number of pixels in a image row. | |
int | m_image_size_j |
The number of rows in a image. | |
int | m_image_size_k |
The number of images in volume. | |
int | m_texture_size_i |
The number of pixels in a row of the texture. | |
int | m_texture_size_j |
The number of rows of an image of the texture. | |
int | m_texture_size_k |
The number of images in the texture. | |
unsigned int | m_format |
External pixel format, i.e how many components. | |
unsigned int | m_type |
External pixel type, i.e. unsigned char, unsigned short etc.. | |
bool | m_cubic |
If true texture coordiates are in the range [0..width]x[0..height]x[0..depth] otherwise they are in the range [0..1]x[0..1]x[0..1]. | |
unsigned int | m_texture_target |
The texture target. | |
float | m_unpack_scale |
Scaling of pixel data when transfering from processor to GPU. Default value is 1.0. | |
GLint | m_tmp [10] |
Temporariy storage used to stack pixel store settings. |
A 3D Texture convenience Class. This class encapsylates all openGL technicalities in dealing with 3D textures.
OpenTissue::texture::Texture3D::Texture3D | ( | int | internal_format, | |
int | image_width, | |||
int | image_height, | |||
int | image_depth, | |||
int | format, | |||
int | type, | |||
const void * | pixels, | |||
bool | cubic = false , |
|||
float | unpack_scale = 1.0 | |||
) | [inline] |
Texture3D Constructor.
internal_format | The number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16. | |
image_width | The width of the image. | |
image_height | The height of the image. | |
image_depth | The depth of the image. | |
format | The format of the pixel data. It can assume one of the symbolic values: GL_COLOR_INDEX, GL_RED, GL_GREEN,GL_BLUE,GL_ALPHA,GL_RGB,GL_RGBA,GL_BGR_EXT,GL_BGR_EXT GL_BGRA_EXT,GL_LUMINANCE,GL_LUMINANCE_ALPHA | |
type | The data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, and GL_FLOAT. | |
pixels | A pointer to the image data in memory. | |
cubic | ||
unpack_scale | Pixel transfering scaling during unpacking. (12 bit Dicom usually needs scale=16) |
OpenTissue::texture::Texture3D::Texture3D | ( | int | internal_format, | |
int | texture_size_i, | |||
int | texture_size_j, | |||
int | texture_size_k, | |||
int | format, | |||
int | type, | |||
bool | cubic = false , |
|||
float | unpack_scale = 1.0 | |||
) | [inline] |
Construct Empty Texture. This constructor allocates a texture of the specified size, without loading any data into the texture.
internal_format | The number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16. | |
texture_size_i | The width of the image. | |
texture_size_j | The height of the image. | |
texture_size_k | The depth of the image. | |
format | The format of the pixel data. It can assume one of the symbolic values: GL_COLOR_INDEX, GL_RED, GL_GREEN,GL_BLUE,GL_ALPHA,GL_RGB,GL_RGBA,GL_BGR_EXT,GL_BGR_EXT GL_BGRA_EXT,GL_LUMINANCE,GL_LUMINANCE_ALPHA | |
type | The data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, and GL_FLOAT. | |
cubic | ||
unpack_scale | Pixel transfering scaling during unpacking. (12 bit Dicom usually needs scale=16) |
OpenTissue::texture::Texture3D::~Texture3D | ( | ) | [inline] |
void OpenTissue::texture::Texture3D::bind | ( | ) | const [inline] |
Bind Texture. This method makes sure that the texture target is enabled and the texture object is bound.
int OpenTissue::texture::Texture3D::check_texture_size | ( | int | internal_format, | |
int | width, | |||
int | height, | |||
int | depth, | |||
int | external_format, | |||
int | external_type | |||
) | [inline] |
Get Texture Size This method test is the desired texture can be loaded into texture memory. Note it does not test whether the texture would actually be resident in texture memory. It only tests if there is available resources!!!
internal_format | The number of color components in the texture. Must be 1, 2, 3, or 4, or one of the following symbolic constants: GL_ALPHA, GL_ALPHA4, GL_ALPHA8, GL_ALPHA12, GL_ALPHA16, GL_LUMINANCE, GL_LUMINANCE4, GL_LUMINANCE8, GL_LUMINANCE12, GL_LUMINANCE16, GL_LUMINANCE_ALPHA, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE6_ALPHA2, GL_LUMINANCE8_ALPHA8, GL_LUMINANCE12_ALPHA4, GL_LUMINANCE12_ALPHA12, GL_LUMINANCE16_ALPHA16, GL_INTENSITY, GL_INTENSITY4, GL_INTENSITY8, GL_INTENSITY12, GL_INTENSITY16, GL_R3_G3_B2, GL_RGB, GL_RGB4, GL_RGB5, GL_RGB8, GL_RGB10, GL_RGB12, GL_RGB16, GL_RGBA, GL_RGBA2, GL_RGBA4, GL_RGB5_A1, GL_RGBA8, GL_RGB10_A2, GL_RGBA12, or GL_RGBA16. | |
width | The width of the texture image. | |
height | The height of the texture image. | |
depth | The depth of the texture image. | |
external_format | The format of the pixel data. It can assume one of the symbolic values: GL_COLOR_INDEX, GL_RED, GL_GREEN,GL_BLUE,GL_ALPHA,GL_RGB,GL_RGBA,GL_BGR_EXT,GL_BGR_EXT GL_BGRA_EXT,GL_LUMINANCE,GL_LUMINANCE_ALPHA | |
external_type | The data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_BITMAP, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, and GL_FLOAT. |
void OpenTissue::texture::Texture3D::clear_pixel_transfer | ( | ) | [inline, protected] |
Clear Pixel Transfer Specifics. This method must should be preceeded by a call to setup_pixel_transfer.
void OpenTissue::texture::Texture3D::create | ( | unsigned int | texture_ID = 0 |
) | [inline, protected] |
bool OpenTissue::texture::Texture3D::cubic | ( | ) | const [inline] |
int OpenTissue::texture::Texture3D::depth | ( | ) | const [inline] |
int OpenTissue::texture::Texture3D::get_internal_format | ( | ) | const [inline] |
unsigned int OpenTissue::texture::Texture3D::get_texture_ID | ( | ) | const [inline] |
unsigned int OpenTissue::texture::Texture3D::get_texture_target | ( | ) | const [inline] |
int OpenTissue::texture::Texture3D::height | ( | ) | const [inline] |
bool OpenTissue::texture::Texture3D::is_valid_sampler_type | ( | std::string const & | sampler_type | ) | const [inline] |
Validate Sampler Type. This method tests if sampler type is compatible with this 2D texture. This method is invoked by Program when setting an input texture for a Cg program.
sampler_type | A textutual representation of the Cg sampler type. |
void OpenTissue::texture::Texture3D::load | ( | T const * | pixels | ) | [inline] |
Load Texture From Memory.
pixels | A pointer to the contiguos memory location where texture data should be loaded from. |
void OpenTissue::texture::Texture3D::load_sub_image_into_texture | ( | int | image_skip_i, | |
int | image_skip_j, | |||
int | image_skip_k, | |||
int | image_size_i, | |||
int | image_size_j, | |||
int | image_size_k, | |||
int | texture_offset_i, | |||
int | texture_offset_j, | |||
int | texture_offset_k, | |||
int | texture_fill_i, | |||
int | texture_fill_j, | |||
int | texture_fill_k, | |||
T const * | pixels | |||
) | [inline] |
Load sub region of image into subregion of texture.
image_skip_i | The image pixel offset from where loading should start. | |
image_skip_j | The image row offset from where loading should start. | |
image_skip_k | The image offset from where loading should start. | |
image_size_i | The total number of pixels along i-axis. | |
image_size_j | The total number of pixels along j-axis. | |
image_size_k | The total number of pixels along k-axis. | |
texture_offset_i | The row starting position. | |
texture_offset_j | The height starting position. | |
texture_offset_k | The image starting position. | |
texture_fill_i | The number of pixels to fill in a texture row. | |
texture_fill_j | The number of rows to fill in a texture image. | |
texture_fill_k | The number of images to fill into the texture. | |
pixels | A pointer to the contiguos memory location where texture data should be loaded from. |
void OpenTissue::texture::Texture3D::set_repeating | ( | bool | flag | ) | [inline] |
Set Texture Wrapping Mode.
flag | If true texture wrapping is set to GL_REPEAT otherwise it is set to GL_CLAMP. |
void OpenTissue::texture::Texture3D::setup_pixel_transfer | ( | ) | [inline, protected] |
Sets up Pixel Transfer Specifics. This method must be paired with a call to clear_pixel_transfer.
float OpenTissue::texture::Texture3D::unpack_scale | ( | ) | const [inline] |
int OpenTissue::texture::Texture3D::width | ( | ) | const [inline] |
bool OpenTissue::texture::Texture3D::m_cubic [protected] |
If true texture coordiates are in the range [0..width]x[0..height]x[0..depth] otherwise they are in the range [0..1]x[0..1]x[0..1].
unsigned int OpenTissue::texture::Texture3D::m_format [protected] |
External pixel format, i.e how many components.
int OpenTissue::texture::Texture3D::m_image_size_i [protected] |
The number of pixels in a image row.
int OpenTissue::texture::Texture3D::m_image_size_j [protected] |
The number of rows in a image.
int OpenTissue::texture::Texture3D::m_image_size_k [protected] |
The number of images in volume.
int OpenTissue::texture::Texture3D::m_image_skip_i [protected] |
The pixel offset in an image row, from where to start loading pixel data.
int OpenTissue::texture::Texture3D::m_image_skip_j [protected] |
The row offset in an image, from where to start loading pixel data.
int OpenTissue::texture::Texture3D::m_image_skip_k [protected] |
The image offset in an volume, from where to start loading pixel data.
int OpenTissue::texture::Texture3D::m_internal_format [protected] |
The internal format of the texture, i.e. how many color compoents (and their size).
bool OpenTissue::texture::Texture3D::m_owned [protected] |
Boolean flag indicating whether this texture instance owns the texture object.
GLuint OpenTissue::texture::Texture3D::m_texture_ID [protected] |
The ID of the texture object.
int OpenTissue::texture::Texture3D::m_texture_size_i [protected] |
The number of pixels in a row of the texture.
int OpenTissue::texture::Texture3D::m_texture_size_j [protected] |
The number of rows of an image of the texture.
int OpenTissue::texture::Texture3D::m_texture_size_k [protected] |
The number of images in the texture.
unsigned int OpenTissue::texture::Texture3D::m_texture_target [protected] |
The texture target.
GLint OpenTissue::texture::Texture3D::m_tmp[10] [protected] |
Temporariy storage used to stack pixel store settings.
unsigned int OpenTissue::texture::Texture3D::m_type [protected] |
External pixel type, i.e. unsigned char, unsigned short etc..
float OpenTissue::texture::Texture3D::m_unpack_scale [protected] |
Scaling of pixel data when transfering from processor to GPU. Default value is 1.0.