Static methods
staticfromBitmapData(data:BitmapData, format:Context3DTextureFormat = Context3DTextureFormat.BGRA, mipmaps:Bool = false, ?params:Null<FoxTextureParams>):FoxTexture
staticfromImage(name:String, mipmaps:Bool = false, format:Context3DTextureFormat = Context3DTextureFormat.BGRA, ?params:Null<FoxTextureParams>):FoxTexture
Loads a FoxTexture from an image located in images/ (with .png extension)
staticfromImageRaw(name:String, mipmaps:Bool = false, format:Context3DTextureFormat = Context3DTextureFormat.BGRA, ?params:Null<FoxTextureParams>):FoxTexture
Loads a FoxTexture using a full raw asset path (including extension)
This may also include compressed textures with the .dds and .astc extension
staticfromImageCompressed(name:String, ?params:Null<FoxTextureParams>):FoxTexture
Loads a compressed texture.
Note: This behaves exactly like fromImageRaw, meaning the path is relative and must include file extension
Foxlite supports S3TC formats (DXT) in most platforms except mobile, and ASTC in most platforms, except some web browsers. ASTC is only available in OpenGL 3+.
This expects a texture in the DDS format or ASTC format. A binary file containing a header, width, height, pixel format and data. This may also contain mipmaps. 3D Textures and texture arrays are not supported.
You can use AMD's Compressonator to compress them in S3TC format. For ASTC, use astc-encoder.
Note 2: In WebGL, texture dimensions MUST be a multiple of 4
staticcreate(width:Int, height:Int, format:String = "rgba", type:String = "unsigned_byte"):FoxTexture
Creates a texture on the GPU, this texture can be used as a render target.
For a friendly list of available formats, check MDN's texImage2D() types.
It applies for standard OpenGL aswell, with the exception of WEBGL_.
staticwrap(bitmap:BitmapData):FoxTexture
Lighter version of fromBitmapData()
Note: Use this if the bitmap data already has a GPU texture attached to it.
Constructor
new(wrapMode:FoxWrapMode = FoxWrapMode.CLAMP, filter:FoxTextureFilter = FoxTextureFilter.LINEAR, mipFilter:FoxMipFilter = FoxMipFilter.MIPNONE)
Variables
read onlyloaded:Bool
Wheter or not this texture is loaded
This property also indicates wheter this texture has a valid glTexture,
usually assigned when images load
Methods
resize(width:Int, height:Int):FoxTexture
Resizes this texture. Intended for framebuffer textures,
Note: This will not work with textures that have been wrapped/loaded from a file.
take(bitmap:BitmapData):Void
Instance version of FoxTexture.wrap()
Takes a BitmapData and sets it as the GPU texture
Note: This will not update any extra information of this texture, such as format or type.
takeGL(texture:TextureBase):Void
Instance version of FoxTexture.wrapGL()
Takes a Texture and sets it as the GPU texture
Note: This will not update any extra information of this texture, such as format or type.