Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglTexture2D Class Reference

#include <sglTexture2D.hpp>

Inheritance diagram for sglTexture2D::

sglTexture sglTexturingStatelet sglStatelet sglObject List of all members.

Public Methods

 sglTexture2D ()
virtual ~sglTexture2D ()
bool setImage (void *image, ExternalFormatEnum format, TypeEnum type, unsigned int num_s, unsigned int num_t, bool border=false)
void getImage (void *&image, ExternalFormatEnum &format, TypeEnum &type, unsigned int &num_s, unsigned int &num_t, bool &border) const
bool setMipmapLevels (const vector< void *> &images)
bool subloadImage (void *sub_image, GLint level, GLint offset_x, GLint offset_y, GLint width, GLint height)
virtual bool replaceImage (void *new_image, GLint level=0)
void getSize (unsigned int &width, unsigned int &height) const
virtual unsigned int getIdealInternalSize () const
virtual unsigned int getLikelyInternalSize () const
void setWrapMode (WrapEnum s_repeat_flag, WrapEnum t_repeat_flag)
void getWrapMode (WrapEnum &s_repeat_flag, WrapEnum &t_repeat_flag) const
virtual bool checkProxy ()
virtual void bind ()
bool copyTexSubImage (GLint level, GLint offset_x, GLint offset_y, GLint win_x, GLint win_y, GLint width, GLint height)
virtual bool buildMipmaps (vector< void *> &mipmaps)
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Static Public Methods

bool resizeImage (sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type, unsigned int old_s, unsigned int old_t, bool border, unsigned int new_s, unsigned int new_t, void *old_image, void *&new_image)
bool halveImage (sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type, unsigned int &num_s, unsigned int &num_t, bool border, void *old_image, void *&new_image)

Detailed Description

container for 2D image data used for texturing

Definition at line 39 of file sglTexture2D.hpp.


Member Function Documentation

bool sglTexture2D::setImage ( void * image,
ExternalFormatEnum format,
TypeEnum type,
unsigned int num_s,
unsigned int num_t,
bool border = false )
 

Set the image to be textured (level zero).

bool sglTexture2D::setMipmapLevels ( const vector< void *> & images ) [virtual]
 

Set the mipmap images. Returns false if number of images is not correct or if the AutoMipmap feature is on. Assumes that the images are correct in size and format.

Reimplemented from sglTexture.

bool sglTexture2D::subloadImage ( void * sub_image,
GLint level,
GLint offset_x,
GLint offset_y,
GLint width,
GLint height )
 

Replace all or part of a contiguous subregion of the current image.

bool sglTexture2D::replaceImage ( void * new_image,
GLint level = 0 ) [virtual]
 

Helper function to replace an entire image via subtexload funtionality. The new_image data must be the same size as the original image set by setImage, and the pointer to the old image data is lost. Returns false if the parameters are out of range.

Reimplemented from sglTexture.

void sglTexture2D::getSize ( unsigned int & width,
unsigned int & height ) const [inline]
 

Get the size of the level zero image.

Definition at line 98 of file sglTexture2D.hpp.

unsigned int sglTexture2D::getIdealInternalSize ( ) const [virtual]
 

Returns the number of bytes of texture memory this texture will use if the requested internal format was honored.

Reimplemented from sglTexture.

unsigned int sglTexture2D::getLikelyInternalSize ( ) const [virtual]
 

Returns the number of bytes of texture memory this texture is most likely using. Must be called by a thread with a current rendering context.

Reimplemented from sglTexture.

void sglTexture2D::setWrapMode ( WrapEnum s_repeat_flag,
WrapEnum t_repeat_flag )
 

Get/set whether the texture repeats or is stretched by tex coords > 1.

bool sglTexture2D::checkProxy ( ) [virtual]
 

Use the GL_PROXY_TEXTURE mechanism to check if the texture is capable of being loaded into texture memory. Returns false if the texture is too large. Must be called by a thread with a current rendering context.

Reimplemented from sglTexture.

void sglTexture2D::bind ( ) [virtual]
 

Copy texture (and changes) into texture memory. If (getAutoBind() == false), this method must be called before before the texture can be applied. Must be called by a thread with a current rendering context.

Reimplemented from sglTexture.

bool sglTexture2D::copyTexSubImage ( GLint level,
GLint offset_x,
GLint offset_y,
GLint win_x,
GLint win_y,
GLint width,
GLint height )
 

Replace all or part of a contiguous subregion of the current image.

bool sglTexture2D::buildMipmaps ( vector< void *> & mipmaps ) [virtual]
 

Generates a set of mipmaps from the level 0 image in this texture. Existing images in the given mipmaps vector will be resized (via realloc) and excess images will be free()'d. Returns false if the mipmaps could not be built.

Reimplemented from sglTexture.

bool sglTexture2D::resizeImage ( sglTexture::ExternalFormatEnum format,
sglTexture::TypeEnum type,
unsigned int old_s,
unsigned int old_t,
bool border,
unsigned int new_s,
unsigned int new_t,
void * old_image,
void *& new_image ) [static]
 

Creates a new image (using malloc) from another image, but with a different size. Note that the new and old sizes are NOT constrained to be a power of two. Also note that this method is slow.

Parameters:
format   the format of the image data
type   the type of each pixel
old_s   the width of the old image
old_t   the height of the old image
border   true if the image has a one pixel border
new_s   the width of the new image
new_t   the height of the new image
old_image   the old image
new_image   a pointer to the pointer to the new image; this pointer will be realloced to the appropriate size
Returns:
false on failure

bool sglTexture2D::halveImage ( sglTexture::ExternalFormatEnum format,
sglTexture::TypeEnum type,
unsigned int & num_s,
unsigned int & num_t,
bool border,
void * old_image,
void *& new_image ) [static]
 

Creates a new image one quarter the size (x/2, y/2) of another image. This method is much faster than resizeImage(). Note that num_s and num_t must be divisible by two.

Parameters:
format   the format of the image data
type   the type of each pixel
num_s   should be called with the width of the old image, on return this is set the the width of the new image
num_t   should be called with the height of the old image, on return this is set the the height of the new image
border   true if the image has a one pixel border
old_image   the old image
new_image   a pointer to a pointer to the new image; this pointer will be realloced to the appropriate size
Returns:
false on failure

virtual void sglTexture2D::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglTexture.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:10 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001