Classes | Typedefs | Functions

OpenTissue::texture Namespace Reference

Classes

class  Texture2D
class  Texture3D

Typedefs

typedef boost::shared_ptr
< Texture2D
texture2D_pointer
typedef boost::shared_ptr
< Texture3D
texture3D_pointer

Functions

texture2D_pointer create_float_texture (unsigned int width, unsigned int height, unsigned int components, float const *pixels)
texture2D_pointer create_float_texture_rectangle (unsigned int width, unsigned int height, unsigned int components, float const *pixels)
texture2D_pointer create_unsigned_byte_texture_rectangle (unsigned int width, unsigned int height, unsigned int components, unsigned char const *pixels)
texture2D_pointer create_unsigned_byte_texture (unsigned int width, unsigned int height, unsigned int components, const unsigned char *pixels)
template<typename grid_type >
texture3D_pointer create_texture3D_from_grid (grid_type &grid)
template<typename T >
texture3D_pointer create_texture3D (int texture_size_i, int texture_size_j, int texture_size_k)
template<>
texture3D_pointer create_texture3D< unsigned short > (int texture_size_i, int texture_size_j, int texture_size_k)
template<typename texture2D_pointer >
void show_texture2D (texture2D_pointer texture)
unsigned int external_format (unsigned int channels)
template<typename T >
unsigned int external_type ()
template<>
unsigned int external_type< double > ()
template<>
unsigned int external_type< float > ()
template<>
unsigned int external_type< int > ()
template<>
unsigned int external_type< unsigned int > ()
template<>
unsigned int external_type< unsigned short > ()
template<>
unsigned int external_type< short > ()
template<>
unsigned int external_type< char > ()
template<>
unsigned int external_type< unsigned char > ()
template<typename T >
unsigned int internal_format (int channels)
template<>
unsigned int internal_format< unsigned char > (int channels)
template<>
unsigned int internal_format< char > (int channels)
template<>
unsigned int internal_format< short > (int channels)
template<>
unsigned int internal_format< unsigned short > (int channels)
template<>
unsigned int internal_format< int > (int channels)
template<>
unsigned int internal_format< unsigned int > (int channels)
template<>
unsigned int internal_format< float > (int channels)

Typedef Documentation


Function Documentation

texture2D_pointer OpenTissue::texture::create_float_texture ( unsigned int  width,
unsigned int  height,
unsigned int  components,
float const *  pixels 
) [inline]

Create 2D Float Texture.

Parameters:
width 
height 
components 
pixels 
Returns:
texture2D_pointer OpenTissue::texture::create_float_texture_rectangle ( unsigned int  width,
unsigned int  height,
unsigned int  components,
float const *  pixels 
) [inline]

Create 2D Float Texture RECT.

Parameters:
width 
height 
components 
pixels 
Returns:
template<typename T >
texture3D_pointer OpenTissue::texture::create_texture3D ( int  texture_size_i,
int  texture_size_j,
int  texture_size_k 
) [inline]

Create Empty Texture. Example usage:

texture3D_poitner tex = create_texture3D<unsigned short>(32,32,32);

Parameters:
texture_size_i The number of pixels in a row of the texture.
texture_size_j The number of rows in an image of the texture.
texture_size_k The number of images in the texture.
Returns:
A pointer to the newly created 3D texture.
template<>
texture3D_pointer OpenTissue::texture::create_texture3D< unsigned short > ( int  texture_size_i,
int  texture_size_j,
int  texture_size_k 
) [inline]
template<typename grid_type >
texture3D_pointer OpenTissue::texture::create_texture3D_from_grid ( grid_type grid  )  [inline]

Create 3D texture from Grid. This function choices the lowest power-of 2 texture fitting the grid-dimensions best.

Parameters:
grid The grid from which texture data should be loaded.
Returns:
A pointer to the newly created 3D texture.
texture2D_pointer OpenTissue::texture::create_unsigned_byte_texture ( unsigned int  width,
unsigned int  height,
unsigned int  components,
const unsigned char *  pixels 
) [inline]

Create Unsigned Byte 2D Texture Rect.

Parameters:
width 
height 
components 
pixels 
Returns:
texture2D_pointer OpenTissue::texture::create_unsigned_byte_texture_rectangle ( unsigned int  width,
unsigned int  height,
unsigned int  components,
unsigned char const *  pixels 
) [inline]

Create Unsigned Byte 2D Texture.

Parameters:
width 
height 
components 
pixels 
Returns:
unsigned int OpenTissue::texture::external_format ( unsigned int  channels  )  [inline]

Determine External Pixel Format. External refers to CPU side, whereas internal refers to GPU side.

Parameters:
channels The number of channels in the external pixel data.
Returns:
The best openGL type for the external format.
template<typename T >
unsigned int OpenTissue::texture::external_type (  )  [inline]

Determine External Pixel Type. External refers to CPU side, whereas internal refers to GPU side. This function is implemented using specialization, Example usage:

unsigned int type = external_type<unsigned char>();

Returns:
The best openGL type for the external type.
template<>
unsigned int OpenTissue::texture::external_type< char > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< double > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< float > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< int > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< short > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< unsigned char > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< unsigned int > (  )  [inline]
template<>
unsigned int OpenTissue::texture::external_type< unsigned short > (  )  [inline]
template<typename T >
unsigned int OpenTissue::texture::internal_format ( int  channels  )  [inline]

Determine Internal Pixel Type. External refers to CPU side, whereas internal refers to GPU side. This function is implemented using specialization, Example usage:

unsigned int format = internal_format<unsigned char>(4);

The specialization types indicates the number of bits in each color component (or if a float texture is wanted). The channels parameter indicates how many color components that is wanted.

Parameters:
channels The number of channels in the internal pixel format.
Returns:
The best openGL type for the internal format.
template<>
unsigned int OpenTissue::texture::internal_format< char > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< float > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< int > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< short > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< unsigned char > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< unsigned int > ( int  channels  )  [inline]
template<>
unsigned int OpenTissue::texture::internal_format< unsigned short > ( int  channels  )  [inline]
template<typename texture2D_pointer >
void OpenTissue::texture::show_texture2D ( texture2D_pointer  texture  )  [inline]

Show 2D Texture This function displays the specified texture as a full-screen image.

Parameters:
texture A pointer to the 2D texture that should be displayed.