CPPGPGPU Library - Reference (Doxygen)

Main Page | General Use | Reference | Examples Info | Get/Download CPPGPGPU | SF.net Page

Texture Class Reference

Element for setting texture states in OpenGL. More...

#include <OGLParts.h>

List of all members.

Public Member Functions

 Texture ()
 ~Texture ()
bool MakeDynamicTexture (int iWidth, int iHeight, TextureType tt)
bool LoadTextureFile (const char *sFileName)
 Load the image from the drive in the format of a .ppm file.
bool LoadTexture (char *sRawData, int iWidth, int iHeight, TextureType tt)
 Load the image from raw data on the CPU.
bool ActivateTexture (int iPlace=0)
 Activate the texture in the iPlaceth slot.
bool DeactivateTexture (int iPlace=0)
 Deactivate the texture in the iPlaceth slot.
unsigned int GetTexHandle ()
 Obtain the OpenGL Texture handle.
bool StripFromScreen (int x, int y, int width, int height)
 Strip the texture from the screen into the texture. Note, you must have.
int GetWidth ()
 Get width of the texture.
int GetHeight ()
 Get height of the texture.
void ChangeFilter (bool bNearest)

Private Attributes

GLuint iTexture
TextureType mtt
int mWidth
int mHeight


Detailed Description

Element for setting texture states in OpenGL.

This can be used for loading .ppm files or just data straight from the drive. the idea is that you turn on textures like states. Once a texture is loaded you can turn it on to affect anything that gets drawn. Most systems have 4-8 texture slots that can be activated and used as input for your shaders.

Textures can have data inputted into them from either a file, CPU memory, stripped off of the screen or written by a render/frame buffer.

Definition at line 141 of file OGLParts.h.


Constructor & Destructor Documentation

Texture::Texture (  )  [inline]

Definition at line 144 of file OGLParts.h.

Texture::~Texture (  ) 

Definition at line 417 of file OGLParts.cpp.


Member Function Documentation

bool Texture::MakeDynamicTexture ( int  iWidth,
int  iHeight,
TextureType  tt 
)

Setup the texture to behave as a dynamic texture. This is to be used when you write to it using the screen or a render/frame buffer.

Definition at line 437 of file OGLParts.cpp.

bool Texture::LoadTextureFile ( const char *  sFileName  ) 

Load the image from the drive in the format of a .ppm file.

Definition at line 456 of file OGLParts.cpp.

bool Texture::LoadTexture ( char *  sRawData,
int  iWidth,
int  iHeight,
TextureType  tt 
)

Load the image from raw data on the CPU.

Definition at line 482 of file OGLParts.cpp.

bool Texture::ActivateTexture ( int  iPlace = 0  ) 

Activate the texture in the iPlaceth slot.

Definition at line 509 of file OGLParts.cpp.

bool Texture::DeactivateTexture ( int  iPlace = 0  ) 

Deactivate the texture in the iPlaceth slot.

Definition at line 517 of file OGLParts.cpp.

unsigned int Texture::GetTexHandle (  )  [inline]

Obtain the OpenGL Texture handle.

Definition at line 164 of file OGLParts.h.

bool Texture::StripFromScreen ( int  x,
int  y,
int  width,
int  height 
)

Strip the texture from the screen into the texture. Note, you must have.

Definition at line 424 of file OGLParts.cpp.

int Texture::GetWidth (  )  [inline]

Get width of the texture.

Definition at line 171 of file OGLParts.h.

int Texture::GetHeight (  )  [inline]

Get height of the texture.

Definition at line 174 of file OGLParts.h.

void Texture::ChangeFilter ( bool  bNearest  ) 

Switch between glNearest (1) or glNicest (0). You want to use Nearest for any data processing, and Nicest for anything that will be presented.

Definition at line 501 of file OGLParts.cpp.


Member Data Documentation

GLuint Texture::iTexture [private]

Definition at line 180 of file OGLParts.h.

TextureType Texture::mtt [private]

Definition at line 181 of file OGLParts.h.

int Texture::mWidth [private]

Definition at line 182 of file OGLParts.h.

int Texture::mHeight [private]

Definition at line 182 of file OGLParts.h.


The documentation for this class was generated from the following files:
© 2005-2007 Charles Lohr, Joshua Allen, David Chapman, Andrew Lohr. All material including documentation under the MIT/X11 license.