Horde3D
http://horde3d.org/forums/

Simple SDL app not working
http://horde3d.org/forums/viewtopic.php?f=2&t=529
Page 1 of 1

Author:  kornerr [ 11.10.2008, 06:36 ]
Post subject:  Simple SDL app not working

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.

Author:  kornerr [ 11.10.2008, 06:56 ]
Post subject:  Re: Simple SDL app not working

Reading inside xml I found it links to many things in the Binaries/Content dir. I linked horde Content dir to data dir where binary resides. Moved cube* files to data/models and material/cube to data/materials. Removed setResourcePath calls, set loadResourcesFromDisk("/home/kornerr/ae/horde3d/data").
And it still returns 0 for loadResourcesFromDisk, and displays black screen.

Author:  kornerr [ 11.10.2008, 10:08 ]
Post subject:  Re: Simple SDL app not working

Looking into Knight example I understood that reousrcePath defaults to current dir.
So I grabbed
Code:
Horde3DUtils::setResourcePath( ResourceTypes::SceneGraph, "models" );
    Horde3DUtils::setResourcePath( ResourceTypes::Geometry, "models" );
    Horde3DUtils::setResourcePath( ResourceTypes::Animation, "models" );
    Horde3DUtils::setResourcePath( ResourceTypes::Material, "materials" );
    Horde3DUtils::setResourcePath( ResourceTypes::Code, "shaders" );
    Horde3DUtils::setResourcePath( ResourceTypes::Shader, "shaders" );
    Horde3DUtils::setResourcePath( ResourceTypes::Texture2D, "textures" );
    Horde3DUtils::setResourcePath( ResourceTypes::TextureCube, "textures" );
    Horde3DUtils::setResourcePath( ResourceTypes::Effect, "effects" );
    Horde3DUtils::setResourcePath( ResourceTypes::Pipeline, "pipelines" );

from the example and now "cout << loadResources" returns 1.
Although, the screen is still black.

Author:  kornerr [ 11.10.2008, 10:54 ]
Post subject:  Re: Simple SDL app not working

I used platform.scene.xml instead of my cube and now it's displayed. Strange.
How should I construct my cube to make it visible?
I tried to remove <Mesh .../> from cube.scene.xml, that didn't help.

Author:  Volker [ 11.10.2008, 19:34 ]
Post subject:  Re: Simple SDL app not working

I have to admit, that I'm a little bit confused of all your messages, but I guess your problem is that most of your resources are not loaded because they couldn't be found. Two advices in this case:
- First check the engine log
- Second debug into the loadResourcesFromDisk method and check the file paths when opening the files.

Author:  kornerr [ 12.10.2008, 03:09 ]
Post subject:  Re: Simple SDL app not working

All resources are now loaded, log displays no errors, but my cube model isn't displayed.
code
cube
log

Author:  Volker [ 12.10.2008, 06:19 ]
Post subject:  Re: Simple SDL app not working

I couldn't find any texture information in the collada file. You might try the blender exporter script together with the attached shader if you don't intend to use textures. In this case you have to make sure the material color uniform in the exported material file is named Materialcol as specified in the shader.

To make sure that's the problem in your case you can also try enabling the wireframe mode. If the problem is the missing texture you should see the geometry when activating it.

Attachments:
Materialcol.shader.zip [996 Bytes]
Downloaded 576 times

Author:  kornerr [ 12.10.2008, 11:37 ]
Post subject:  Re: Simple SDL app not working

You mean I can't use plain box?
Enabling Wireframe mode didn't help. Nothing showed up.
Sorry, I don't know about uniforms and all that. It seems Horde is really all about shaders.

Author:  Volker [ 12.10.2008, 18:29 ]
Post subject:  Re: Simple SDL app not working

kornerr wrote:
You mean I can't use plain box?

You can if you adjust the shaders that they don't relay on texture information anymore.
kornerr wrote:
Sorry, I don't know about uniforms and all that. It seems Horde is really all about shaders.

Yes it is!

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/