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

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = NULL;

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

//Set texture properties
texture->SetClampMode(true, true);
texture->SetFilter(Texture::Smooth);


while (true)
{
context->SetColor(0, 0, 0, 0);
context->Clear();

//Display texture properties
context->SetColor(1, 1, 1, 0);
context->SetBlendMode(Blend::Alpha);

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

context->SetBlendMode(Blend::Solid);
context->DrawImage(texture, 0, y);

context->Sync();
}
return 0;
}