H3D::X3DTextureNode Class Reference
[Abstract nodes.]

This abstract node type is the base type for all node types which specify sources for texture images. More...

#include <X3DTextureNode.h>

Inheritance diagram for H3D::X3DTextureNode:

Inheritance graph
List of all members.

Public Member Functions

 H3D_API_EXCEPTION (InvalidTextureDimensions)
 Thrown by renderImage () if the dimensions of an image are invalid, e.g.
 H3D_API_EXCEPTION (OpenGLTextureError)
 Thrown when an OpenGL error occurs while setting up the texture.
 H3D_API_EXCEPTION (glTexImageFunctionNotDefined)
 Thrown when a subclass to X3DTextureNode calls renderImage without defining the glTexImage () function.
 X3DTextureNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0)
 Constructor.
virtual void enableTexturing ()=0
 Virtual function for making all OpenGL calls that are needed to enable texturing for the texture.
virtual void disableTexturing ()=0
 Virtual function for making all OpenGL calls that are needed to disable texturing for the texture.
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value.
virtual void preRender ()
 This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function.
virtual void postRender ()
 This function will be called by the X3DShapeNode after the geometry has been rendered to restore the states to what it was before the call to preRender().
virtual Vec3f textureSize ()
 Sometimes the texture represents a volume in space, e.g.
virtual GLuint renderImage (Image *image, GLenum texture_target, bool scale_to_power_of_two)
 Installs the image as a OpenGL texture.
virtual GLint glInternalFormat (Image *image)
 Returns the internal OpenGL format to use given an Image, e.g.
virtual GLenum glPixelFormat (Image *image)
 Returns the OpenGL pixel format to use given an Image, e.g.
virtual GLenum glPixelComponentType (Image *image)
 Returns the OpenGL pixel compnent type to use given an Image, e.g.
virtual void glTexImage (Image *image, GLenum texture_target, bool scale_to_power_of_two)
 Install the given image as a OpenGL texture with a call to a glTexImage function.

Static Public Member Functions

static X3DTextureNodegetActiveTexture ()
 Gets the currently active texture, i.e.

Static Protected Member Functions

static void * padTo4ByteAlignment (const void *data, unsigned int width, unsigned int height, unsigned int depth, unsigned int bits_per_pixel)
static void setActiveTexture (X3DTextureNode *t)
 Set the active texture.

Detailed Description

This abstract node type is the base type for all node types which specify sources for texture images.


Member Function Documentation

virtual string H3D::X3DTextureNode::defaultXMLContainerField  )  [inline, virtual]
 

Returns the default xml containerField attribute value.

For this node it is "texture".

Reimplemented from H3D::Node.

static X3DTextureNode* H3D::X3DTextureNode::getActiveTexture  )  [inline, static]
 

Gets the currently active texture, i.e.

the texture that is currently bound in OpenGL. NULL us returned if no X3DTextureNode is bound.

GLint X3DTextureNode::glInternalFormat Image image  )  [virtual]
 

Returns the internal OpenGL format to use given an Image, e.g.

GL_LUMINANCE, GL_RGB, GL_RGB8, etc

Reimplemented in H3D::X3DTexture2DNode, and H3D::X3DTexture3DNode.

GLenum X3DTextureNode::glPixelComponentType Image image  )  [virtual]
 

Returns the OpenGL pixel compnent type to use given an Image, e.g.

GL_BYTE, GL_UNSIGNED_INT, etc

GLenum X3DTextureNode::glPixelFormat Image image  )  [virtual]
 

Returns the OpenGL pixel format to use given an Image, e.g.

GL_RGB, GL_LUMINANCE, etc

virtual void H3D::X3DTextureNode::glTexImage Image image,
GLenum  texture_target,
bool  scale_to_power_of_two
[inline, virtual]
 

Install the given image as a OpenGL texture with a call to a glTexImage function.

Subclasses that use the renderImage () function must define this function. By default an glTexImageFunctionNotDefined exception is thrown. if scale_to_power_of_two is true then the image data will be scaled to the closest higher power of two if dimensions are not a power of two.

Reimplemented in H3D::Composed3DTexture, H3D::X3DTexture2DNode, and H3D::X3DTexture3DNode.

H3D::X3DTextureNode::H3D_API_EXCEPTION InvalidTextureDimensions   ) 
 

Thrown by renderImage () if the dimensions of an image are invalid, e.g.

not a power of 2.

virtual void H3D::X3DTextureNode::preRender  )  [inline, virtual]
 

This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function.

So this is the place to save the states that are going to be changed in render() in order to restore it in postRender().

Reimplemented from H3D::X3DAppearanceChildNode.

Reimplemented in H3D::GeneratedCubeMapTexture.

GLuint X3DTextureNode::renderImage Image image,
GLenum  texture_target,
bool  scale_to_power_of_two
[virtual]
 

Installs the image as a OpenGL texture.

Uses the glTexImage function for the glTexImage call, so it has to be defined for subclasses that use this function.

Parameters:
image The image to use as texture.
texture_target The OpenGL texture target to use for the GL texture. E.g. GL_TEXTURE_2D.
scale_to_power_of_two Scale the image data to the closest higher power of two if dimensions are not a power of two.
Returns:
The texture id of the OpenGL texture that got installed.

static void H3D::X3DTextureNode::setActiveTexture X3DTextureNode t  )  [inline, static, protected]
 

Set the active texture.

The active texture is the texture that is currently in bound in OpenGL, so as soon a call to glBindTexture is made this function should be called also a pointer to the texture being bound.

virtual Vec3f H3D::X3DTextureNode::textureSize  )  [inline, virtual]
 

Sometimes the texture represents a volume in space, e.g.

when it contains volume data to be rendered. This function returns the size of the space the volume occupies in metres.

Reimplemented in H3D::X3DTexture3DNode.


Generated on Thu Aug 24 12:40:30 2006 for H3D API by  doxygen 1.4.5