GetFormat

This function gets the format of a texture.

Syntax

Returns

Returns the pixel format of the texture. This may the value Texture::RGBA8, Texture::RGBA, Texture::RGB8, Texture::RGB, Texture::Depth, Texture::Intensity, or Texture::Alpha.

Example

window = Window:Create()
context = Context:Create(window)

--Load a texture
texture = Texture:Load("Materials/Grass/grass01.tex")

--Set texture properties
texture:SetClampMode(true,true)
texture:SetFilter(Texture.Smooth)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

context:SetColor(0,0,0)
context:Clear()

--Display texture properties
context:SetColor(1,1,1)
context:SetBlendMode(Blend.Alpha)

local x=2 local y=2
context:DrawText(texture:CountMipmaps().." mipmaps",x,y); y=y+20
context:DrawText("Clamp mode: " .. tostring(texture:GetClampMode(0))..", "..tostring(texture:GetClampMode(1)),x,y); y=y+20
context:DrawText("Filter: "..texture:GetFilter(),x,y); y=y+20
context:DrawText("Format: "..texture:GetFormat(),x,y); y=y+20
context:DrawText("Size: "..texture:GetWidth().." x "..texture:GetHeight(),x,y); y=y+20

context:SetBlendMode(Blend.Solid)
context:DrawImage(texture,0,y)

context:Sync()
end