ACG::SceneGraph::TextureNode Class Reference

#include <ACG/Scenegraph/TextureNode.hh>

Inheritance diagram for ACG::SceneGraph::TextureNode:
Inheritance graph
[legend]
Collaboration diagram for ACG::SceneGraph::TextureNode:
Collaboration graph
[legend]

List of all members.

Classes

class  TextureInfo

Public Member Functions

 TextureNode (BaseNode *_parent=0, const std::string &_name="<TextureNode>", bool _texture_repeat=true, GLint _texture_filter=GL_LINEAR)
 Default constructor. Applies all properties.
virtual ~TextureNode ()
 Destructor.
 ACG_CLASSNAME (TextureNode)
 set class name
bool alpha ()
 get transparency status
void set_alpha (bool _status)
 set transparency status
bool repeat ()
 get texture repeat status
void set_repeat (bool _status)
 set texture repeat status
GLint filter ()
 get texture filter
void set_filter (GLint _filter)
 set texture filter
void set_texture_mode (GLenum _mode)
Change active texture



bool activateTexture (GLuint _id)
 Set active Texture.
GLuint activeTexture ()
 Get active Texture.
bool read (const char *_filename)
 Uses a QImage to load the texture from the given file.
void set_texture (const QImage &_image)
 Uses a QImage to set the texture.
void set_texture (const float *_image, int _width, int _height)
 Uses a float buffer to set the texture.
void set_texture (const unsigned char *_image, int _width, int _height)
 Uses a byte buffer to set the texture.
Change specific texture



bool read (const char *_filename, GLuint _id)
 Uses a QImage to load the texture from the given file.
void set_texture (const QImage &_image, GLuint _id)
 Uses a QImage to set the texture.
void set_texture (const float *_image, int _width, int _height, GLuint _id)
 Uses a float buffer to set the texture.
void set_texture (const unsigned char *_image, int _width, int _height, GLuint _id)
 Uses a byte buffer to set the texture.
SceneGraph traversal functions



void enter (GLState &_state, unsigned int _drawmode)
 set default texture and states for the nodes children
void leave (GLState &_state, unsigned int _drawmode)
 Unbind Texture.
void enterPick (GLState &_state, PickTarget _target, unsigned int _drawMode)
 Do nothing in picking.
void leavePick (GLState &_state, PickTarget _target, unsigned int _drawMode)
 Do nothing in picking.

Private Member Functions

void setTextureDataGL (GLuint _textureId, GLenum _target, GLint _width, GLint _height, GLenum _format, GLenum _type, const void *_data)
void checkEmpty ()
 Check if a texture is already generated by this Node.
int available (GLuint _id)
 check this node for a texture

Private Attributes

std::vector< TextureInfotextures_
bool alpha_
bool texture_repeat_
GLenum tex_mode_
GLint texture_filter_
int activeTexture_
 currently active texture

Setting textures



GLuint add_texture (const QImage &_image)
 Add a texture to this node.
void applyTextureParameters (int _id)
void applyGLSettings ()

Detailed Description

Set Texture for this node and all its children. All changes will be done in the enter() method undone in the leave() method. Enable Environment Mapping if you need it. To use Blending or AlphaTest use a MaterialNode.

Definition at line 84 of file TextureNode.hh.


Member Function Documentation

bool ACG::SceneGraph::TextureNode::activateTexture ( GLuint  _id  ) 

Set active Texture.

Sets the active texture of this node to the given id

Definition at line 500 of file TextureNode.cc.

References activeTexture_, and available().

GLuint ACG::SceneGraph::TextureNode::activeTexture (  ) 

Get active Texture.

Gets the currently active texture of this node

Definition at line 493 of file TextureNode.cc.

References activeTexture_.

GLuint ACG::SceneGraph::TextureNode::add_texture ( const QImage &  _image  ) 

Add a texture to this node.

Definition at line 399 of file TextureNode.cc.

References activeTexture_, and checkEmpty().

void ACG::SceneGraph::TextureNode::applyGLSettings (  )  [private]

Set basic gl settings

Definition at line 125 of file TextureNode.cc.

void ACG::SceneGraph::TextureNode::applyTextureParameters ( int  _id  )  [private]

Apply the internal texture properties to the currently active texture

Definition at line 139 of file TextureNode.cc.

int ACG::SceneGraph::TextureNode::available ( GLuint  _id  )  [private]

check this node for a texture

Returns the id of the texture if this node handles the texture.
If not -1.

Definition at line 320 of file TextureNode.cc.

Referenced by activateTexture(), read(), and set_texture().

void ACG::SceneGraph::TextureNode::checkEmpty (  )  [private]

Check if a texture is already generated by this Node.

This function will create a texture if no texture exists and set the activeTexture_ to the new one.

Definition at line 306 of file TextureNode.cc.

References activeTexture_.

Referenced by add_texture(), and set_texture().

bool ACG::SceneGraph::TextureNode::read ( const char *  _filename,
GLuint  _id 
)

Uses a QImage to load the texture from the given file.

This function will change the given texture if available.

Definition at line 331 of file TextureNode.cc.

References activeTexture_, available(), and read().

bool ACG::SceneGraph::TextureNode::read ( const char *  _filename  ) 

Uses a QImage to load the texture from the given file.

This function will change the active texture.

Definition at line 105 of file TextureNode.cc.

References set_texture().

Referenced by read().

void ACG::SceneGraph::TextureNode::set_texture ( const unsigned char *  _image,
int  _width,
int  _height,
GLuint  _id 
)

Uses a byte buffer to set the texture.

This function will change the given texture if available.

Assumptions: Buffer is in RGBA format, and either power of two size or using a graphics card that supports arbitrary textures.

Definition at line 380 of file TextureNode.cc.

References activeTexture_, available(), checkEmpty(), and set_texture().

void ACG::SceneGraph::TextureNode::set_texture ( const float *  _image,
int  _width,
int  _height,
GLuint  _id 
)

Uses a float buffer to set the texture.

This function will change the given texture if available.

Assumptions: Buffer is in RGBA format, and either power of two size or using a graphics card that supports arbitrary textures.

Definition at line 364 of file TextureNode.cc.

References activeTexture_, available(), checkEmpty(), and set_texture().

void ACG::SceneGraph::TextureNode::set_texture ( const QImage &  _image,
GLuint  _id 
)

Uses a QImage to set the texture.

This function will change the given texture if available.

Definition at line 347 of file TextureNode.cc.

References activeTexture_, available(), checkEmpty(), and set_texture().

void ACG::SceneGraph::TextureNode::set_texture ( const unsigned char *  _image,
int  _width,
int  _height 
)

Uses a byte buffer to set the texture.

This function will change the active texture.

Assumptions: Buffer is in RGBA format, and either power of two size or using a graphics card that supports arbitrary textures.

Definition at line 230 of file TextureNode.cc.

References activeTexture_, and checkEmpty().

void ACG::SceneGraph::TextureNode::set_texture ( const float *  _image,
int  _width,
int  _height 
)

Uses a float buffer to set the texture.

This function will change the active texture.

Assumptions: Buffer is in RGBA format, and either power of two size or using a graphics card that supports arbitrary textures.

Definition at line 286 of file TextureNode.cc.

References activeTexture_, and checkEmpty().

void ACG::SceneGraph::TextureNode::set_texture ( const QImage &  _image  ) 

Uses a QImage to set the texture.

This function will change the active texture.

Definition at line 252 of file TextureNode.cc.

References activeTexture_, and checkEmpty().

Referenced by read(), and set_texture().


Member Data Documentation

currently active texture

This index is an index to the textures_ vector! Not the GLuint!!

Definition at line 321 of file TextureNode.hh.

Referenced by activateTexture(), activeTexture(), add_texture(), checkEmpty(), enter(), read(), and set_texture().


The documentation for this class was generated from the following files:

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .