• Create Account

### #ActualXuchilbara

Posted 18 February 2013 - 05:45 PM

Here is the shutdown function of my model.cpp

void Model::Shutdown()
{
//Release the model texture
ReleaseTexture();

//Release the vertex and index buffers
ShutdownBuffers();

//Release the model
ReleaseModel();

return;
}


It seems that every single of these functions return a problem when it accesses them, starting with ReleaseTexture() as its at the top. Although after doing some debugging it turns out it's going straight for the Shutdown() method and not the Init() Method during compile, in fact it completely ignores the initialization in the top end class.

Application.cpp

	/* CUBE */
m_Cube = new Model;
if(!m_Cube)
{return false;}

r = m_Cube->Init(m_D3D->GetDevice(), "Shapes/Cube.txt", "Textures/blocktexture.jpg");
if(!r)
{
MessageBox(hwnd, "Cube Failed to load!", "Error!", MB_OK);
return false;
}


Why is it skipping directly to the Shutdown() function in my Application class first?

void Application::Shutdown()
{
if(m_Cube)
{
m_Cube->Shutdown();
delete m_Cube;
m_Cube = 0;
}

...
}


### #1Xuchilbara

Posted 18 February 2013 - 05:35 PM

Here is the shutdown function of my model.cpp

void Model::Shutdown()
{
//Release the model texture
ReleaseTexture();

//Release the vertex and index buffers
ShutdownBuffers();

//Release the model
ReleaseModel();

return;
}


It seems that every single of these functions return a problem when it accesses them, starting with ReleaseTexture() as its at the top. Although after doing some debugging it turns out it's going straight for the Shutdown() method and not the Init() Method during compile, in fact it completely ignores the initialization in the top end class.

Application.cpp

	/* CUBE */
m_Cube = new Model;
if(!m_Cube)
{return false;}

r = m_Cube->Init(m_D3D->GetDevice(), "Shapes/Cube.txt", "Textures/blocktexture.jpg");
if(!r)
{
MessageBox(hwnd, "Cube Failed to load!", "Error!", MB_OK);
return false;
}


Why is it skipping directly to the Shutdown() function in my model class first?

PARTNERS