Following the
wiki topic about SDL I re-wrote it with little omissions:
Code:
#include <horde3d/Horde3D.h>
#include <horde3d/Horde3DUtils.h>
#include <SDL.h>
#include <iostream>
using namespace std;
using namespace Horde3D;
using namespace Horde3DUtils;
ResHandle model = 0,
cam = 0;
int main() {
SDL_Init(SDL_INIT_VIDEO);
SDL_WM_SetCaption("Horde3D + SDL", 0);
int w = 800,
h = 600;
SDL_SetVideoMode(w, h, 32, SDL_OPENGL);
init();
resize(0, 0, w, h);
setResourcePath(ResourceTypes::Pipeline, "");
setResourcePath(ResourceTypes::SceneGraph, "");
setResourcePath(ResourceTypes::Geometry, "");
ResHandle pipeRes = addResource(ResourceTypes::Pipeline,
"forward.pipeline.xml", 0);
ResHandle modelRes = addResource(ResourceTypes::SceneGraph,
"cube.scene.xml", 0);
cout << "loaded all: " << loadResourcesFromDisk("") << endl;
model = addNodes(RootNode, modelRes);
NodeHandle light = addLightNode(RootNode, "Light1", 0, "LIGHTING",
"SHADOWMAP");
setNodeTransform(light, 0, 20, 0, 0, 0, 0, 1, 1, 1);
setNodeParamf(light, LightNodeParams::Radius, 50);
setNodeParamf(light, LightNodeParams::FOV, 90);
setNodeParami(light, LightNodeParams::ShadowMapCount, 3);
setNodeParamf(light, LightNodeParams::ShadowSplitLambda, 0.9f);
setNodeParamf(light, LightNodeParams::ShadowMapBias, 0.001f);
setNodeParamf(light, LightNodeParams::Col_R, 0.9f);
setNodeParamf(light, LightNodeParams::Col_G, 0.7f);
setNodeParamf(light, LightNodeParams::Col_B, 0.75f);
cam = addCameraNode(RootNode, "Camera", pipeRes);
bool running = true;
SDL_Event event;
while(running) {
if(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT)
running = false;
}
render(cam);
SDL_GL_SwapBuffers();
}
release();
SDL_Quit();
return 0;
}
The "cout << loadResourcesFromDisk" gives me 0. So all I see is a black screen.
In the current dir where binary resides I have:
Code:
cube.geo, cube.scene.xml, forward.pipeline.xml
To create cube, I just run Blender, saved the default cube as Collada 1.4, then issued ColladaConverter upon the *.dae file. It has also created *anim file, which I removed.
What can be the problem?
Thanks.