Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Class Members

Texture Class Reference
[Scene Graph]

#include <lvt/Texture.h>

Inheritance diagram for Texture:

Inheritance graph
[legend]
List of all members.

Detailed Description

Abstract base class for an OpenGL texture.

To create a texture object, first instantiate the class, then call Load to load pixel data into the texture object. If the texture is stored externally in one of the supported file formats (See Texture::Load for a list), then you call Load with the filename of the pixel data and the object will read the data from file.

If the file format is generated procedurally, stored internally, or not in one of the supported file formats, Load can be called with approximately the same arguments as glTexture*D.

Both versions of Load will automatically generate mipmaps if they are not present in the source file.

To disable texturing in part of a scenegraph, create an empty texture object and disable it with State::Disable(). Then attach the object to the scenegraph at the point you want textures disabled.


Public Member Functions

GLenum GetMagFilter () const
 Returns the current magnification filter for the texture object.
GLenum GetMinFilter () const
 Returns the current minification filter for the texture object.
GLenum GetWrapR () const
 Returns the current texture wrap mode in the R direction.
GLenum GetWrapS () const
 Returns the current texture wrap mode in the S direction.
GLenum GetWrapT () const
 Returns the current texture wrap mode in the T direction.
virtual bool Load (unsigned int x, unsigned int y, const unsigned char *bitmap, int border=0, GLint internalFormat=GL_RGBA8, GLenum externalFormat=GL_RGBA, GLenum type=GL_UNSIGNED_BYTE)
 Creates a new texture object with the specified pixel data.
virtual bool Load (const std::string &fileName)
 Creates a new texture object and loads pixel data from a file.
virtual void Render ()=0
 Binds the texture to its texture unit, and enables texturing, if necessary.
void SetMagFilter (GLenum filter)
 Sets the magnification filter.
void SetMinFilter (GLenum filter)
 Sets the minification filter for the texture object.
void SetWrap (GLenum s, GLenum t, GLenum r=GL_REPEAT)
 Sets the current texture wrap mode.


Member Function Documentation

GLenum GetMagFilter  )  const [inline]
 

Returns the current magnification filter for the texture object.

GLenum GetMinFilter  )  const [inline]
 

Returns the current minification filter for the texture object.

GLenum GetWrapR  )  const [inline]
 

Returns the current texture wrap mode in the R direction.

GLenum GetWrapS  )  const [inline]
 

Returns the current texture wrap mode in the S direction.

GLenum GetWrapT  )  const [inline]
 

Returns the current texture wrap mode in the T direction.

virtual bool Load unsigned int  x,
unsigned int  y,
const unsigned char *  bitmap,
int  border = 0,
GLint  internalFormat = GL_RGBA8,
GLenum  externalFormat = GL_RGBA,
GLenum  type = GL_UNSIGNED_BYTE
[virtual]
 

Creates a new texture object with the specified pixel data.

Parameters:
x Texture width
y Texture height
bitmap Pixel Data
border Width of the texture border (either 0 or 1)
internalFormat One of the internal format constants used by glTexture*D.
externalFormat One of the external format constants used by glTexture*D.
type The type of pixel data in the buffer pointed to by bitmap.

virtual bool Load const std::string &  fileName  )  [virtual]
 

Creates a new texture object and loads pixel data from a file.

The following file formats are supported:

  • Windows Bitmap (.bmp, .dib)
  • Truvision Targa (.tga)
  • DirectDraw Surface (.dds)
  • ZSoft Paint (.pcx)

virtual void Render  )  [pure virtual]
 

Binds the texture to its texture unit, and enables texturing, if necessary.

Implements TextureState.

Implemented in Texture1D, and Texture2D.

void SetMagFilter GLenum  filter  )  [inline]
 

Sets the magnification filter.

Parameters:
filter One of GL_NEAREST or GL_LINEAR.

void SetMinFilter GLenum  filter  )  [inline]
 

Sets the minification filter for the texture object.

Parameters:
filter One of the texture minification functions accepted by glTexParameter.

void SetWrap GLenum  s,
GLenum  t,
GLenum  r = GL_REPEAT
 

Sets the current texture wrap mode.


Generated on Thu Feb 17 09:45:48 2005 for liblvt by  doxygen 1.4.1