back to index

Texture

Inheritance

Object -> Texture

Constants

TEX_16BIT              - try to upload as a 16bit texture to save memory
TEX_REPEAT_S           - repeat texture on the x axis 
TEX_REPEAT_T           - repeat texture on the y axis 
TEX_DELETE             - do not keep the texture in system memory after upload()
TEX_AUTOMIPMAP
TEX_MODULATE           - modulate the texture pixels by the current foreground color
TEX_BLEND
TEX_DECAL
TEX_REPLACE
TEX_MINFILTERLINEAR    - use bilinear filtering when collapsing pixels
TEX_MINFILTERTRILINEAR - use trilinear filtering when collapsing pixels
TEX_MAGFILTERLINEAR    - use bilinear filtering when expanding pixels
TEX_MAGFILTERTRILINEAR - use trilinear filtering when expanding pixels
TEX_ALPHA              - texture actually uses the alpha component
TEX_1D                 - bind texture to GL_TEXTURE_1D target instead of GL_TEXTURE_2D
TEX_FORCEHOSTBYTEORDER - assume that the 32 bit texture is stored in the host byte order format. 
                        Intel uses BGRA while Motorola uses RGBA
TEX_INTENSITY

Properties

sx    - 
sy    - 
z     - 
flags - 

Methods

      adjustBrightness  (float _bright) - blend to white
      adjustGamma       (float _gamma) - fade to black
int   alloc             (int _w, int _h, int _z) - allocate image. the intial pixel data is undefined
      applyColorMap     (Texture _indexed, Texture _palette) - apply colormap _palette to texture _indexed and store result in this texture (must have been allocated)
      bind              () - bind this texture to the GL_TEXTURE_2D or GL_TEXTURE_1D texture target (depends on flags)
      blend             (Texture _srca, Texture _srcb, float _ratio)
      clear             (int _clearcolor) - clear screen with given #aarrggbb clear color
      colorKeyToAlpha   (int _ckey) - set alpha component to 0 if rgb matches _ckey
      copyRegion        (Texture _src, IVector _src_left_top, IVector _size, IVector _dest_left_top) - copy a rectangular region of the given texture to this texture. clip region if necessary.
float countPixels       (int _ckey) - count number of pixels that have a specific color. can be used for statistical optimization of algorithms (e.g. input images for a →bumpmapper←)
      drawFilledBox     (IVector _p, IVector _s, int _color) - draw a filled rectangle (software rendered ofcourse)
      drawLine          (IVector _q, IVector _p, int _color) - draw a line from _q to _p (software rendered ofcourse)
      drawPixels        (Vector _rasterpos) - copy texture to the given screen raster position
      drawPixels2i      (int _x, int _y) - copy texture to the given screen raster position
      drawPixels2f      (float _x, float _y) - copy texture to the given screen raster position
      drawPixels3f      (float _x, float _y, float _z) - copy texture to the given screen raster position
      drawPolygon       (IntArray _points, int _color) - draw a filled (convex) polygon (software rendered ofcourse)
      expand2n          () - resize texture so its width and height are GL-compatible (adds empty space if necessary).
      free              () - free OpenGL ressource and pixel data
int   getFlags          ()
int   getId             ()
int   getStride         () - return bytesperpixel (z) * width
int   getSx             () - get width of texture 
int   getSy             () - get height of texture 
int   getXY32           (int _x, int _y) - the slowest way to read a pixel ;)
int   getZ              () - get number of bytes per pixels (1,2,3,4)
int   grayscale         () - convert to 8bit grayscale image
      interleaveAlpha   (Texture _t) - copy alpha component from 8 bit image
int   loadImage         (String _name, int _w, int _h, int _z) - load image from VFS and convert to given size/colordepth (leave _w,_h,_z 0 to skip conversions)
int   loadLocalImage    (String _name, int _w, int _h, int _z) - load image from local file system and convert to given size/colordepth (leave _w,_h,_z 0 to skip conversions)
      renderFixedText   (Texture _font, int _charWidth, String _text, int _textOff, int _x, int _y, IntArray _cellColors, IntArray _cellAttributes) - see the test_renderFixedText.tks example
int   saveImage         (String _name) - save PNG image to local file system
      scaleFrom         (Texture _t) - scale given texture to match this textures size and color depth
      scroll            (int _dx, int _dy) - xxx: not all scroll directions are possible atm, see source
      setFlags          (int)
      setPriority       (float _p) - set OpenGL texture priority
      setScreen         (Texture _t) - share screen among several textures
      setScreenArea     (Texture _t, IVector _left_top, IVector _size) - share (a part of) the screen of the given texture with this texture
      setXY32           (int _x, int _y, int _color) - the slowest way to set a pixel ;)
      simpleBlur        (Texture _dest)
      simpleBlurX       (Texture _dest)
      swapScreen        (Texture _t) - swap screen with other texture
      update            () - re-upload texture, do not assign a new GL nameid. can be used for procedural textures.
      updateRegion      (int _x, _y, _w, _h) - re-upload sub-texture, do not assign a new GL nameid. can be used for procedural textures.
      upload            () - upload to OpenGL and create a nameid if necessary. required after the viewport has been created or changed (fullscreen/window mode switch)

Examples

cubeworld.tks
crparticles.tks

back to index