Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 13:22

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 11.10.2008, 06:36 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
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.


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2008, 06:56 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
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.


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2008, 10:08 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
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.


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2008, 10:54 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
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.


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2008, 19:34 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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.


Top
 Profile  
Reply with quote  
PostPosted: 12.10.2008, 03:09 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
All resources are now loaded, log displays no errors, but my cube model isn't displayed.
code
cube
log


Top
 Profile  
Reply with quote  
PostPosted: 12.10.2008, 06:19 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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
Top
 Profile  
Reply with quote  
PostPosted: 12.10.2008, 11:37 
Offline

Joined: 27.09.2008, 07:34
Posts: 35
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.


Top
 Profile  
Reply with quote  
PostPosted: 12.10.2008, 18:29 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
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!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group