GetTexture

This function gets a material texture. The function does not increment the texture's reference count.

Syntax

Parameters

Returns

Returns the material texture.

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 = World::Create();
Camera* camera = Camera::Create();
Light* light = DirectionalLight::Create();
light->SetRotation(45, 35, 0);

Material* material = Material::Load("Materials/Concrete/concrete_clean.mat");

//Retrieve the material texture
Texture* texture = material->GetTexture();

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
context->SetColor(0, 0, 0, 0);
context->Clear();
context->SetColor(1, 1, 1, 0);

//Display the texture on screen
context->DrawImage(texture, 0, 0);
context->Sync();
}
return 0;
}