Horde3D
http://horde3d.org/forums/

Horde3D v1.0.0 Beta5 and SFML2
http://horde3d.org/forums/viewtopic.php?f=2&t=1621
Page 1 of 1

Author:  zester [ 07.01.2012, 05:36 ]
Post subject:  Horde3D v1.0.0 Beta5 and SFML2

I am trying to get Horde and SFML2 working, everything appears to be working fine except I can't
get the knight mesh to display. Could someone help me out with this? :)

Here is a screenshot
Image


My Code
Code:
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

#include <horde3d/Horde3D.h>
#include <horde3d/Horde3DUtils.h>
 
#include <iostream>
#include <stdexcept>
 
// Engine objects
H3DRes  forwardPipeRes;
H3DNode  cam,  knight;
H3DRes  logoMatRes, knightRes;
 
using namespace std;

bool initGame( int width, int height )
{
   
   // Initialize engine
   if( !h3dInit() )
   {   
      h3dutDumpMessages();
      return false;
   }
   
   //
   forwardPipeRes = h3dAddResource( H3DResTypes::Pipeline, "pipelines/forward.pipeline.xml", 0 );
    knightRes = h3dAddResource( H3DResTypes::SceneGraph, "models/knight/knight.scene.xml", 0 );
    logoMatRes = h3dAddResource( H3DResTypes::Material, "overlays/logo.material.xml", 0 );
   
    h3dutLoadResourcesFromDisk("Content");

   cout << "loaded all: " << h3dutLoadResourcesFromDisk( "Content" ) << endl;

   // Add knight
    knight = h3dAddNodes( H3DRootNode, knightRes );
   h3dSetNodeTransform( knight,  10, 0, 0, 0, 0, 0, 1, 1, 1 );
    if(!knight)
          cout << "knight creation failed\n";
 
    // Add light source
    H3DNode light = h3dAddLightNode( H3DRootNode, "Light1", 0, "LIGHTING", "SHADOWMAP" );
    h3dSetNodeTransform( light, 0, 20, 0, 0, 0, 0, 1, 1, 1 );

   cam = h3dAddCameraNode( H3DRootNode, "Camera", forwardPipeRes );     
    if(!cam)
         cout << "cam creation failed\n";
       
    h3dSetNodeParamI( cam, H3DCamera::ViewportXI, 0 );
    h3dSetNodeParamI( cam, H3DCamera::ViewportYI, 0 );
    h3dSetNodeParamI( cam, H3DCamera::ViewportWidthI, width );
    h3dSetNodeParamI( cam, H3DCamera::ViewportHeightI, height );
    h3dSetupCameraView( cam, 45.0f, static_cast<float>(width)/height, 0.1f, 1000.0f );
    h3dResizePipelineBuffers( forwardPipeRes, width, height );
}


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::RenderWindow window(sf::VideoMode(1024, 600), "SFML OpenGL", sf::Style::Default, sf::ContextSettings(32));
 
    // Create a clock for measuring the time elapsed
    sf::Clock clock;
 
    initGame(1024, 600 );

    // Start game loop
    while (window.IsOpened())
    {
        // Process events
        sf::Event event;
        while (window.PollEvent(event))
        {

         if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape))
         {
             window.Close();
         }
      }
      
        window.SaveGLStates();
       
        const float ww = (float)h3dGetNodeParamI( cam, H3DCamera::ViewportWidthI ) /
        (float)h3dGetNodeParamI( cam, H3DCamera::ViewportHeightI );
           const float ovLogo[] = { ww-0.4f, 0.8f, 0, 1,  ww-0.4f, 1, 0, 0,  ww, 1, 1, 0,  ww, 0.8f, 1, 1 };
        h3dShowOverlays( ovLogo, 4, 1.f, 1.f, 1.f, 1.f, logoMatRes, 0 );
                           
        h3dRender( cam);
       
        window.RestoreGLStates();

        window.Display();
    }
   
 
    h3dutDumpMessages();
    h3dRelease();
   
    return EXIT_SUCCESS;
}





Horde Log
Code:
Horde3D Log

Horde3D 1.0.0 Beta5

0.000   
Initializing GL2 backend using OpenGL driver '3.3.0 NVIDIA 290.10' by 'NVIDIA Corporation' on 'GeForce 8500 GT/PCI/SSE2'
0.016   
Loading resource 'pipelines/forward.pipeline.xml'
0.016   
Loading resource 'models/knight/knight.scene.xml'
0.017   
Loading resource 'overlays/logo.material.xml'
0.017   
Loading resource 'pipelines/globalSettings.material.xml'
0.017   
Loading resource 'models/knight/knight.geo'
0.023   
Loading resource 'models/knight/knight.material.xml'
0.023   
Loading resource 'shaders/overlay.shader'
0.023   
---- C O M P I L I N G  . S H A D E R . shaders/overlay.shader@OVERLAY[0] ----
0.024   
Loading resource 'overlays/logo.tga'
0.029   
Loading resource 'textures/ambientMap.dds'
0.032   
Loading resource 'shaders/model.shader'
0.033   
Loading resource 'models/knight/knight.jpg'
0.035   
Loading resource 'models/skybox/skybox.dds'
0.040   
Loading resource 'shaders/utilityLib/vertCommon.glsl'
0.040   
Loading resource 'shaders/utilityLib/vertSkinning.glsl'
0.040   
---- C O M P I L I N G  . S H A D E R . shaders/model.shader@SHADOWMAP[1] ----
0.042   
Loading resource 'shaders/utilityLib/fragDeferredWrite.glsl'
0.042   
---- C O M P I L I N G  . S H A D E R . shaders/model.shader@ATTRIBPASS[1] ----
0.044   
Loading resource 'shaders/utilityLib/fragLighting.glsl'
0.044   
---- C O M P I L I N G  . S H A D E R . shaders/model.shader@LIGHTING[1] ----
0.050   
---- C O M P I L I N G  . S H A D E R . shaders/model.shader@AMBIENT[9] ----
0.053   
Loading resource 'textures/common/defnorm.tga'




Thanks

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