Noob question: error when trying to use load library[SOLVED]

pidmaster

19-06-2006 23:06:09

I'm new to programing so my code is mostly an amalgam of several of the wiki tutorials, a bit of trail and error, etc. I've got a working Ogre application without the ofusion scene loader library and this code originated from that working code, minus the code I had for manualy constructing my scene(and some code that had to do with input that is not relevant to testing the scene loader). Now I am trying to recreate the same scene using the scene loader.

First, my code. Second, the error that I am getting.

#include <iostream>
#include <string>
#include <Ogre.h>
#include <OgreOSMScene.h>
#include <IOSMSceneCallbacks.h>
#include <tinyxml.h>
#define OgreProject "C:\\OgreProject"
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
INT WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif

{
using namespace Ogre;
Root *root = new Root();

RenderSystemList *rsList = root->getAvailableRenderers();
int c = 0;
RenderSystem *selectedRenderSystem = 0;

do
{
if (c == (int) rsList->size())
return 0;
selectedRenderSystem = rsList->at(c);
c++;
}

while (selectedRenderSystem->getName().compare("Direct3D9 Rendering Subsystem") !=0);

root->setRenderSystem(selectedRenderSystem);
selectedRenderSystem->setConfigOption("Full Screen","No");
selectedRenderSystem->setConfigOption("Video Mode","800 x 600 @ 32-bit colour");

ConfigOptionMap comap = selectedRenderSystem->getConfigOptions();
ConfigOptionMap::const_iterator start = comap.begin();
ConfigOptionMap::const_iterator end = comap.end();
while (start != end)
{
String OptionName = start->first;
String CurrentValue = start->second.currentValue;
StringVector PossibleValues = start->second.possibleValues;
int c=0;
while (c < (int) PossibleValues.size())
{
String OneValue = PossibleValues.at(c);
c++;
}
start++;
}


root->initialise(false);

RenderWindow* window = root->createRenderWindow("Main",800,600,false);

OSMScene oScene;
oScene.initialise("crate_scene.osm");
oScene.createScene();
SceneManager *sceneMgr = oScene.getSceneManager();

return 0;
}



obj\Debug\OgreProject\OgreProject\mainFusion.o: In function `ZN4Ogre13_ConfigOptionC1ERKS0_':C:/OgreSDK/stlport/stlport/stl/_pair.h:54: undefined reference to `OSMScene::OSMScene(Ogre::SceneManager*, Ogre::RenderWindow*)'
:C:/OgreSDK/stlport/stlport/stl/_pair.h:54: undefined reference to `OSMScene::initialise(char const*, OSMSceneCallbacks*)'
:C:/OgreSDK/stlport/stlport/stl/_pair.h:54: undefined reference to `OSMScene::createScene(Ogre::SceneNode*)'
:C:/OgreSDK/stlport/stlport/stl/_pair.h:54: undefined reference to `OSMScene::~OSMScene()'
:C:/OgreSDK/stlport/stlport/stl/_pair.h:54: undefined reference to `OSMScene::~OSMScene()'


Any clue as to how I can begin trying to fix this problem would be appreciated. With my limited knowledge I can only procede through trial and error or with the example of other code, in the absence of that it's mostly guesswork. This error points me to a file outside of my main file that I can't, or rather, shouldn't change directly so for me it is a dead end because I have no clue what to try and change in my application to fix it. I could not find a resolution on the wiki or elsewhere on these forums, so I posted here. My thanks in advance for any help anyone might be able to offer.

In case it helps, I use Codeblocks as my IDE.

Lioric

21-06-2006 17:48:35

Have you included the scene loader ".cpp" files in your project, you need to compile those files within your project/solution

See the "Integrating in your Application" page of the "Scene Loader" chapter of the documentation for more details

pidmaster

22-06-2006 05:53:12

I only included the headers and not the .cpp's after I added the .cpp's it worked. I tell it to load my scene (just a crate and a wooden floor that it sits on); it compiles, runs, loads the scene, opens the render window, then throws an exception. The text in the runner.exe is as follows:

Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
Loading library OgrePlatform_d.dll
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DevIL version: Developer's Image Library (DevIL) 1.6.7 Feb 27 2006
DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mn
g jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda ic
b vst tif tiff wal xpm raw
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
Loading library .\Plugin_CgProgramManager
Loading library .\RenderSystem_Direct3D9
D3D9 : Direct3D9 Rendering Subsystem created.
D3D9: Driver Detection Starts
D3D9: Driver Detection Ends
Loading library .\RenderSystem_GL
OpenGL Rendering Subsystem created.
Loading library .\Plugin_ParticleFX
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Particle Affector Type 'DirectionRandomiser' registered
Particle Affector Type 'DeflectorPlane' registered
Loading library .\Plugin_BSPSceneManager
Registering ResourceManager for type BspLevel
Loading library .\Plugin_OctreeSceneManager
*-*-* OGRE Initialising
*-*-* Version 1.2.0 (Dagon)
D3D9 : RenderSystem Option: Full Screen = No
D3D9 : RenderSystem Option: Video Mode = 800 x 600 @ 32-bit colour
D3D9 : Subsystem Initialising
***************************************
*** D3D9 : Subsystem Initialised OK ***
***************************************
ResourceBackgroundQueue - threading disabled
D3D9 : Created D3D9 Rendering Window 'Main' : 800x600, 32bpp
D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at low
er frame rates, turn VSync on if you observe this problem.
Registering ResourceManager for type Texture
Registering ResourceManager for type GpuProgram
RenderSystem capabilities
-------------------------
* Hardware generation of mipmaps: yes
* Texture blending: yes
* Anisotropic texture filtering: yes
* Dot product texture operation: yes
* Cube mapping: yes
* Hardware stencil buffer: yes
- Stencil depth: 8
- Two sided stencil support: yes
- Wrap stencil values: yes
* Hardware vertex / index buffers: yes
* Vertex programs: yes
- Max vertex program version: vs_3_0
* Fragment programs: yes
- Max fragment program version: ps_3_0
* Texture Compression: yes
- DXT: yes
- VTC: no
* Scissor Rectangle: yes
* Hardware Occlusion Query: yes
* User clip planes: yes
* VET_UBYTE4 vertex element type: yes
* Infinite far plane projection: yes
* Hardware render-to-texture: yes
* Floating point textures: yes
* Non-power-of-two textures: yes
* Volume textures: yes
* Multiple Render Targets: 4
* Point Sprites: yes
* Extended point parameters: yes
* Max Point Size: 8192
Particle Renderer Type 'billboard' registered
Win32Input8: DirectInput Activation Starts
Win32Input8: Establishing keyboard input.
Win32Input8: Keyboard input established.
Win32Input8: Initializing mouse input in immediate mode.
Win32Input8: Mouse input in immediate mode initialized.
Win32Input8: DirectInput OK.
Added resource location 'C:\OgreProject' of type 'FileSystem' to resource group
'General'
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Parsing scripts for resource group General
Parsing script crate_scene.material
Error in material crate at line 13 of crate_scene.material: Invalid vertex_progr
am_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture has not
been defined.
Error in material crate at line 27 of crate_scene.material: Invalid vertex_progr
am_ref entry - vertex program Examples/BumpMapVPSpecular has not been defined.
Error in material crate at line 34 of crate_scene.material: Invalid fragment_pro
gram_ref entry - fragment program Examples/BumpMapFPSpecular has not been define
d.
Error in material crate at line 64 of crate_scene.material: Invalid vertex_progr
am_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture has not
been defined.
Error in material 02_-_Default at line 87 of crate_scene.material: Invalid verte
x_program_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture
has not been defined.
Error in material 02_-_Default at line 101 of crate_scene.material: Invalid vert
ex_program_ref entry - vertex program Examples/BumpMapVPSpecular has not been de
fined.
Error in material 02_-_Default at line 108 of crate_scene.material: Invalid frag
ment_program_ref entry - fragment program Examples/BumpMapFPSpecular has not bee
n defined.
Error in material 02_-_Default at line 140 of crate_scene.material: Invalid vert
ex_program_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture
has not been defined.
Finished parsing scripts for resource group General
Parsing scripts for resource group Internal
Finished parsing scripts for resource group Internal
********************************
** oScene Loader Lib **
********************************
oSceneLoader: Loading 'crate_scene.osm' file
oSceneLoader: Creating scene on 'Root' node
********************************
** oSceneLoader: Scene loaded **
********************************


My crate and floor are both normal mapped according to the normal mapping tutorial on the ofusion site, only with my own targas. It looks to me as though there is something I need to do to make the shaders work.
Is there a resource manager I need to use?

Also a minor question I had about working in Max... Why do my Texture Units default to a scale of 1 when I use pixel shaders, Even though the values in the U and V scale are for example 10 (like mine) this is to tile the map I am using for my floor. If there is no way to tile maps while using shaders I'll have to do something cheesy like tile it in photoshop, and if I maintain current resolution that means making a 2560 x 2560 file. Seems like there has got to be a better way to do this. Any thoughts? I can't help but feel like I'm missing something obvious.

Thanks again for the helpful answers.

Evak

22-06-2006 18:31:38

how are you applying the scale for your UV's. I always use the UVW Map modifier for simple tiling UV's. or Unwrap UVW modifier for any kind of precision.

Those will work perfectly with shaders, whilst many of the settings in the material editor are ignored by shaders, so if your using material preferences to skale your UV's, theres a good chance that they won't work with shaders.

I never tried as I always use the UVW Map modifier which is easier and more configurable.

Lioric

23-06-2006 00:31:26

You need to put the actual shader files in your resource folders

The shader files are in the "ogre_azathoth\media\shaders" folder of your max installation

UV values will be in the (0, 1) range, so you can adda scale factor to your shaders, or as suggested apply a UVW modifier to your objects

pidmaster

25-06-2006 21:37:46

I wasn't able to get it to tile with the values in the texture unit but I was able to solve it with the UVmap. When I entered values between 0 and 1 it was throwing an exception.

As far as the shaders, they are loading properly now, infact my debugger is showing 0 errors and reports the scene loading perfectly. However my render window is now showing me all black. I don't know if this is an ofusion related question or if the problem lies elsewhere. I'm going to look at some FAQs because if I remeber correctly there was some common noob error that resulted in a black render window.

Thanks again for the help!