Visual Studio 2005 and Importing

irishstu

25-07-2006 15:01:35

Hi - I'm having getting oFusion to work with VS
Specifically, I get errors when I try to enter the lines specified in Integrating Your Application"

Below is the code generated when I make a new Ogre project:


------------------------------------------------------------
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2005 The OGRE Team
Also see acknowledgements in Readme.html

You may use this sample code for anything you like, it is not covered by the
LGPL like the rest of the engine.
-----------------------------------------------------------------------------
*/

/*
-----------------------------------------------------------------------------
Filename: testMats2.h
Description: A place for me to try out stuff with OGRE.
-----------------------------------------------------------------------------
*/
#ifndef __testMats2_h_
#define __testMats2_h_


#include "ExampleApplication.h"



class testMats2FrameListener : public ExampleFrameListener
{
private:
SceneManager* mSceneMgr;
public:
testMats2FrameListener(SceneManager *sceneMgr, RenderWindow* win, Camera* cam)
: ExampleFrameListener(win, cam),
mSceneMgr(sceneMgr)
{
}

bool frameStarted(const FrameEvent& evt)
{
bool ret = ExampleFrameListener::frameStarted(evt);


return ret;

}

};



class testMats2App : public ExampleApplication
{
public:
testMats2App()
{}

~testMats2App()
{
}

protected:

virtual void createCamera(void)
{
// Create the camera
mCamera = mSceneMgr->createCamera("PlayerCam");

// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,80));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);
}




// Just override the mandatory create scene method
virtual void createScene(void)
{

Entity* ogreHead = mSceneMgr->createEntity("Head", "OgreHead.mesh");

SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);

// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

// Create a light
Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);
}

// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new testMats2FrameListener(mSceneMgr, mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);
}
};

#endif // #ifndef __testMats2_h_


------------------------------------------------------------

What code do I put in to get my scene loaded, and where does it go?

(sorry if this is a dumb question, I'm only starting to learn this stufff!)

Lioric

25-07-2006 16:57:43

Download the Scene loader Demo application, it contains the sample of how to use the scene loader library in your projects

irishstu

26-07-2006 12:42:50

I tried that and got the following errors:

------ Build started: Project: Demo_oSceneLoader, Configuration: Debug Win32 ------
Compiling...
oSceneLibDemo.cpp
d:\ogre\osceneloader_demo_dagon\osceneloader_demo_dagon\include\oscenelibdemo.h(16) : fatal error C1083: Cannot open include file: 'ExampleApplication.h': No such file or directory
OgreOSMScene.cpp
d:\ogre\osceneloader_demo_dagon\osceneloader_demo_dagon\include\ogreosmscene.h(24) : fatal error C1083: Cannot open include file: 'Ogre.h': No such file or directory
Generating Code...
Build log was saved at "file://d:\ogre\oSceneLoader_demo_dagon\oSceneLoader_demo_dagon\obj\Debug\BuildLog.htm"
Demo_oSceneLoader - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

irishstu

26-07-2006 12:48:53

ok I fixed the above by including the floders that have them files, then got this error:

------ Build started: Project: Demo_oSceneLoader, Configuration: Debug Win32 ------
Compiling...
oSceneLibDemo.cpp
OgreOSMScene.cpp
Generating Code...
Compiling manifest to resources...
Linking...
LINK : fatal error LNK1104: cannot open file 'OgreMain_d.lib'
Build log was saved at "file://c:\OgreSDK\oSceneLoader_demo_dagon\obj\Debug\BuildLog.htm"
Demo_oSceneLoader - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


*edit*

of cousre, if I had included the library, it would have worked - solved that particular problem!