Sign in to follow this  
AndyUni

Some help required

Recommended Posts

Hi new here. need some help on a game im developing for my final year project, lecture says i can get as much help as possible aslong as i mark what isnt my own code, so feel free to help because ill give a link to my lecture of this thread. basically my program is fine till i start trying to render in Direct X i have the SDK but keep getting errors. basically it compiles fine in either debug or release (bar a few warnings of depreciation but had these for every stage ive done so dont think these are a problem). now when i run the .exe file that is created i get "Superpowers has encountered a problem and needs to close sorry for the inconvenience" when i click debug i get: Unhandled exception at 0x00509203 in Superpowers.exe: 0xC0000005: Access violation reading location 0x00000000. and it looks at a line that loads up a mesh. (now removing anything to do with the mesh makes it work so it looking likely that). not sure on what other informaton might be needed so feel free to ask for anything and ill post it ASAP, but i could do with some help/advice as im already a little behind :( Cheers for at least looking.

Share this post


Link to post
Share on other sites
Main.cpp


//-----------------------------------------------------------------------------
// System Includes
//-----------------------------------------------------------------------------
#include <windows.h>

//-----------------------------------------------------------------------------
// Engine Includes
//-----------------------------------------------------------------------------
#include "..\Engine\Engine.h"

//-----------------------------------------------------------------------------
// Test State Class
//-----------------------------------------------------------------------------
class TestState : public State
{
public:
//-------------------------------------------------------------------------
// Allows the test state to preform any pre-processing construction.
//-------------------------------------------------------------------------
virtual void Load()
{
m_mesh = new Mesh( "Gun.x", "./Assets/" );

// Set a suitable view matrix for viewing the test mesh.
D3DXMATRIX view;
D3DXMatrixLookAtLH( &view, &D3DXVECTOR3( -50.0f, 50.0f, -150.0f ), &D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
g_engine->GetDevice()->SetTransform( D3DTS_VIEW, &view );
};

//-------------------------------------------------------------------------
// Allows the test state to preform any post-processing destruction.
//-------------------------------------------------------------------------
virtual void Close()
{
SAFE_DELETE( m_mesh );
};

//-------------------------------------------------------------------------
// Returns the view setup details for the given frame.
//-------------------------------------------------------------------------
virtual void RequestViewer( ViewerSetup *viewer )
{
viewer->viewClearFlags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER;
}

//-------------------------------------------------------------------------
// Renders the test state.
//-------------------------------------------------------------------------
virtual void Render()
{
m_mesh->Render();
};

private:
Mesh *m_mesh; // The test mesh.
};

//-----------------------------------------------------------------------------
// Application specific state setup.
//-----------------------------------------------------------------------------
void StateSetup()
{
g_engine->AddState( new TestState, true );
}

//-----------------------------------------------------------------------------
// Entry point for the application.
//-----------------------------------------------------------------------------
int WINAPI WinMain( HINSTANCE instance, HINSTANCE prev, LPSTR cmdLine, int cmdShow )
{
// Create the engine setup structure.
EngineSetup setup;
setup.instance = instance;
setup.name = "Mesh/Material Test";
setup.scale = 0.01f;
setup.StateSetup = StateSetup;

// Create the engine (using the setup structure), then run it.
new Engine( &setup );
g_engine->Run();

return true;
}


// Allows the test state to preform any pre-processing construction.

is where the debug stops


i have a header file and another .cpp file for just the mesh as everything links into engine.h not sure if you want to see these as debug only sends me to this but ill happily put them up if need be as this has been bugging me since yesterday morning. ahh the joys of programming eh? :)

Share this post


Link to post
Share on other sites
I'll put money on, that you are missing the file, or the path is wrong ;-)

** EDIT - well I'm keeping my $10, only coz you said it compiled in your first post.

Glad you got it sorted ;-)

[Edited by - darren_mfuk on March 2, 2007 11:01:36 AM]

Share this post


Link to post
Share on other sites
ive got it sorted (for now) my lecturer burst into another lecture just to tell me the problem, he says i didnt use a capital M for Mesh in the class

how stupid do i feel now :(

EDIT* confusing now as thinking about it the program wouldnt compaile but meh ill cope he says hes got it to work now so ill take it back off him and keep going

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this