C3DMesh::CreateCubeTexture |
Top Previous Next |
Syntax:
CreateCubeTexture(int texNum, int edgeLength, string name)
Purpose: Creates a cubic environment texture used for rending the reflections of a scene.
Parameters: texNum - The zero based texture number. edgeLength - Size of the edges of all the top-level faces of the cube texture. name - A unique name used internally by the texture manager.
Returned value(s): None
Class Hierarchy -------C3DMesh
Additional Info: Cubic environment maps—sometimes referred to as cube maps—are textures that contain image data representing the scene surrounding an object, as if the object were in the center of a cube. Each face of the cubic environment map covers a 90-degree field of view in the horizontal and vertical, and there are six faces per cube map.
Each face of the cube is oriented perpendicular to the x/y, y/z, or x/z plane, in world space. The following figure shows how each plane corresponds to a face. Not all older video cards support creating cube textures. A message box will be presented to the user if their card lacks the capability. The name of the texture must be unique and is used internally by the texture manager to prevent duplicate resources from being created for the same mesh object.
Higher edge lengths result in more detailed reflections but consume more video ram. Lower edge lengths result in blockier looking reflections but are more suitable for dynamic mapping where the reflection is recalculated every frame. If your combining textures to create semi-reflective surfaces then stick with lower edge lengths. Most video cards require edge lengths to be a power of two.
The approximate amount of video ram require for one cube map is shown below:
Edge Length Memory
Texture coordinates for the mesh containing the cube texture are calculated automatically. If creating a mesh using CreateMesh you don't need to specify an FVF constant for that texture number or include texture coordinates for the cube texture in your vertex buffer.
See Also: BeginRenderCubeTexture, EndRenderCubeTexture
|