Synopsis
define the Graphics Display Kit texture
GDtexture_templ
group+OPort  GDtexture_templ
 {
        Node_Data+Byte+IPort2  &data;
        Node_Data+IPort2  &colormap;
        enum tile { choices = {"Clamp", "Wrap", "Boundary"}; };
        enum alpha { choices = {"Replace", "Modulate", "Decal"}; };
        enum filter { choices = {"Point", "Bilinear", "Trilinear"}; };
        enum type { choices = {"Single Level", "Mip-Map"}; };
        ptr+nonotify local_ptr;
        };
};
GDtexture
GDtexture_templ+IPort2  GDtexture
 {
        local_ptr+write;
        method+notify_inst+notify_val upd_func = "GDtexture_update";
        method+notify_deinst del_func = "GDtexture_delete";
};
DefaultTexture
GDtexture  DefaultTexture
 {
        tile = GD_TILE_CLAMP;
        alpha = GD_ALPHA_REPLACE;
        filter = GD_FILTER_POINT;
        type = GD_TYPE_UNFILTERED;
};
Description
These templates define a Graphics Display Kit texture. GDtexture_templ defines the elements that cause the texture's methods to execute. GDtexture defines an instanceable version without default values. DefaultTexture defines an instanceable version with default values.
Input Ports
data
A connection to the texture map's data. The data may be either a byte scalar or a byte vector of length 3 or 4 with the special data id that indicates that the data is RGB (that is, GD_RGB_DATA_ID).
colormap
An optional connection to the texture map's colormap. The colormap should be of length 256. You include a colormap when texture map's data is byte rather than RGB.
Parameters
tile
This parameter controls what happens when the UV(W) values are outside the 0-1 range.
| Value | Meaning | Symbolic constant | 
| 0 | Clamp UV(W) values that are outside the 0-1 range. Render using the primary color | GD_TILE_CLAMP | 
| 1 | Wrap UV(W) values that are outside the 0-1 range | GD_TILE_WRAP | 
| 2 | Clamp UV(W) values that are outside the 0-1 range. Render using the value at the texture's boundary | GD_TILE_BOUNDARY | 
alpha
This parameter controls how to use the alpha value in the texture pixel to
control transparency.
| Value | Meaning | Symbolic constant | 
| 0 | Replace the alpha in the texture pixel with the object's transparency value | GD_ALPHA_REPLACE | 
| 1 | Modulate the alpha in the texture pixel wth the object's transparency value | GD_ALPHA_MODULATE | 
| 2 | Blend the texture pixel color with the object's pixel color and replace the alpha in the texture pixel with the object's transparency value. | GD_ALPHA_MODULATE | 
filter
This parameter controls the type of filtering to be done when the texure is shrunk or expanded.
| Value | Meaning | Symbolic constant | 
| 0 | Perform point sampling | GD_FILTER_POINT | 
| 1 | Perform bilinear sampling | GD_FILTER_BILINEAR | 
| 2 | Perform trilinear sampling | GD_FILTER_TRILINEAR | 
type
This parameter controls what type of texture is created.
| Value | ||
| 0 | Create an unfiltered texture map | GD_TYPE_UNFILTERED | 
| 1 | Create a MipMapped texture map | GD_TYPE_MIPMAP | 
Example
Libraries.Graphics_Display.Objects.DataObject
File
v/gd.v