Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

GetMaterial() returns NULL

Recommended Posts

If I assign a material to an object in the editor then load it, it displays with the material yet GetMaterial() returns NULL.











#include "App.h"

using namespace Leadwerks;

App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}

App::~App() { delete world; delete window; }

bool wireframe = false;

bool App::Start()
	window = Window::Create();
	context = Context::Create(window);

	world = World::Create();

	camera = Camera::Create();
	camera->Move(0, 0, -15);

	auto m = Model::Load("Models\\Characters\\Generic\\generic.mdl");

	//auto mat = Material::Load("Materials\\Developer\\bluegrid.mat");

	auto m2 = m->GetMaterial();//returns NULL unless I load the material and apply it via code

	return true;

bool App::Loop()
	if (window->KeyHit(Key::Escape) == true) { return false; }
	if (window->KeyHit(Key::F3) == true) { camera->SetDebugPhysicsMode(!camera->GetDebugPhysicsMode()); }
	if (window->KeyHit(Key::F2) == true) {
		if (wireframe == true) {
			wireframe = false;
		else {
			wireframe = true;



	return true;

I am using the latest update on the default branch.

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...