PEXTextureMap PEXCreateMipmapTMFromResources( Display *display, int dimensionality, int texel_type, Drawable drawable, unsigned short luminance_channel, unsigned short alpha_channel, int num_levels, PEXTexelDimension *dimensions, XID *color_data, XID *alpha_data )
The resource ID for a PEX Texture Map.
Invoke PEXCreateMipmapTMFromResources to create a mipmap texture resource that you can reference from a texture mapping LUT.
If the texture map is one-dimensional, then one color resource and, optionally, one alpha resource define each level of the texture map, starting with the base level. Texture coordinate t0 = 0.0 corresponds to the lower lower-left of the image defined by the resource. Subsequent texel values are taken from the bottom row of the resource along the x direction. The rows of the resource are conceptually wrapped, so it is possible for a texture map level's dimension to exceed the x dimension of the resource. The wrapping occurs by moving up to the left end of the next higher row as each row is exhausted.The dimension of each level of the texture map is defined by argument dimension, which is an array with a member for each level of the texture map. The texture map coordinates are normalized, so the first through c0th texel, where c0 is the t0 dimension, correspond to the t0 coordinate range from 0.0 to 1.0.
In the two-dimensional texture map case, again one color resource, and optionally one alpha resource, defines each level of the texture map, starting with the base level. Texture map coordinate t0 = t1 = 0.0 corresponds to the lower-left of the image defined by the source. The x direction of the resource corresponds to the t0 direction of the texture map. The texture map dimensions for a given level cannot exceed the corresponding resource dimensions.
In the three-dimension texture map case, c2 color resources, and optionally c2 alpha resources, define each level of the texture map. c2, defined by argument dimension for each level, is the third dimension of the level. The c2 resources defining each level are ordered from t2 = 0.0 to t2 = 1.0. All c2 resources defining the base level are given first, followed by all the resources defining the next level, and so on.
The dimensionality argument indicates the dimension of the texture map. The list of color and alpha resource IDs provides the actual texel data. The visual of the drawable specified by drawable indicates the source texel format.
Texel_type indicates the texel components of the newly created texture resource. If the texel_type indicates luminance is included, then luminance_channel indicates whether one of three channels of RGB are given as luminance data, or if all three channels are combined into a single luminance value. If the texel_type indicates that the luminance is not included (in the destination texels), then the implementation ignores the luminance_channel. If the texel_type indicates alpha is included, then the alpha_channel argument indicates whether one of three channels of RGB are given as alpha data, or if all three channels are combined into a single alpha value. If the texel_type indicates that alpha is not included, then the implementation ignores alpha_data and alpha_channel.
PEXlib defines the following values for the channel selection constants (luminance_channel and alpha_channel):
Inquire MaxFastTMSize with the function PEXGetImpDepConstants to determine whether there is a maximum size for any dimension on the base level which must be respected to achieve optimized implementation. If PEX has such a limit, it treats larger texture maps in an implementation-dependent way. PEX implementations may have other restrictions on the dimensions of each level of the texture map. Inquire PowerOfTwoTMRequired with PEXGetImpDepConstants to determine if each dimension must be a power of two. Inquire SquareTMRequired with the same request to determine if all the dimensions on each level must be equal to one another.
Drawable indicates the visual of the resources. Both the color_data and alpha_data resources must be of the same visual class. If the visual is of class PseudoColor, then the colormap associated with the drawable is used to determine the color values. The visual indicates the source texel format.
Not all resource types are supported for creating texture map resources. PEXlib defines the following texel resources. Invoke PEXGetEnumTypeInfo to determine which resources types your implementation supports.
Once this function returns, all texel data source resources may be reused for other purposes
For a list of related topics and for a list of all texture mapping functions, see Texture Mapping.