GINO Graphics Suite - GINO v9.0  

gDefineTexture

Syntax

[C/C++:]
void gDefineTexture(int level, int xgrid, int ygrid, int border, int nbyte, int *pixbuf);
[F90:]
subroutine gDefineTexture(level, xgrid, ygrid, border, nbyte, pixbuf)
integer, intent(in) :: level,xgrid,ygrid,nbyte,border,pixbuf(*)

Arguments

level
Texture map detail level

0 = base level
>0 = mipmap reduction level

xgrid, ygrid
Dimension of pixel array

border
Border switch

GOFF = No border supplied
GON= Border of 1 pixel on each side supplied with data

nbyte
Number of relevant bytes in texture map data (default = 3)

pixbuf
Pixel array used to define texture

Description

The routine gDefineTexture() defines the current texture map, of which only one can exist at any defined level.

The texture map detail level is set in level, where a value of zero implies that the base level (largest) texture map is being defined. Levels greater than zero can be used to define smaller mipmapped images for the same texture. Each level must be smaller in both directions by a power of 2 than the preceding level.

The dimensions of the texture map are defined in xgrid and ygrid. Both must be 2**n (or 2**n+2 if border is switched on) but not necessarily equal. The maximum size of a texture map is limited to the equivalent of 1024x1024 pixels.

The value of nbyte is in the range 1-4 with the following interpretation of data supplied in pixbuf

nbyte      Bits 31-24  Bits 23-16  Bits 15-8  Bits 7-0 
1          1           -           -          Luminance
2          1           -           Alpha      Luminance
3(Default) 1           Red         Green      Blue
4          Alpha OR 1  Red         Green      Blue


The data supplied in pixbuf comprises xgrid * ygrid integer values in one of four forms; a) an array of colour index values with RGB settings being interpreted from the current GINO colour table, b) an array of 24bit packed RGB triplets as returned by the function gTrueCol, c) external image data read in by the routine gGetImageFile() or d) manually constructed data. For types a) - c) nbyte should be set to 3, for type d) bit 24 of all array values should be set to 1.

See Also

gDefineTexture Usage
gGetImageFile
gSetTextureMappingMode