#0 

01-12-2010 21:34:22

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

Bonjour, j'ai fini par choisir un moteur physique répondant a mes besoins Newton.

Or une nouvelle venant toujours avec un bug, quand je lance mon programme il me dit dans une fenêtre windows disant :
L'application n'a pas réussi a démarrer correctement (0xc000007b). Cliquer sur OK ...

voila mon code si sa peut vous aidez :

Code c++ :


#include <Irrlicht.h>
#include <newton.h>

// use scale factor between Newton and irr
const float NewtonToIrr = 32.0f;
const float IrrToNewton = (1.0f / NewtonToIrr);

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


int main()
{
   //create Newton world
   NewtonWorld* nWorld = NewtonCreate ();
   // set Irrlicht
    IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(1024, 768), 32,false, false, false);

   video::IVideoDriver* driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();

       // add mesh
   scene::ImeshSceneNode* beat = smgr->addSphereSceneNode(10,64);
    if (beat)
    {
        beat->setMaterialFlag(video::EMF_LIGHTING, false);
    }

    core::aabbox3d<f32> box = beat->getBoundingBox();
    core::vector3df size = box.getExtent() * IrrToNewton;
    NewtonCollision* collision = NewtonCreateBox(nWorld, size.X, size.Y, size.Z, NULL, NULL);
    static NewtonBody*  beat_Body = NewtonCreateBody(nWorld, collision);
    NewtonReleaseCollision (nWorld, collision);

    // set the body mass and inertia
    NewtonBodySetMassMatrix (beat_Body, 1.0f, 5.0f, 1.0f, 5.0f);

    //NewtonBodySetUserData(beat_Body, beat);
    //NewtonBodySetDestructorCallback (beat_Body, DestroyPistonEvent);

    core::matrix4 matrix = beat->getRelativeTransformation();
    core::vector3df origin = matrix.getTranslation() * IrrToNewton;
    matrix.setTranslation (origin);
    NewtonBodySetMatrix(beat_Body, &matrix.M[0]);
    // animate the body by setting the angular velocity
    float omega[] = {0.0f, 10.0f, 0.0f};
    NewtonBodySetOmega (beat_Body, &omega[0]);

    // add camera & hide cursor
    smgr->addCameraSceneNode(0, core::vector3df(3,0,3), core::vector3df(0,0,0));
    device->getCursorControl()->setVisible(false);
    // count FPS
   int lastFPS = -1;

   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(255,100,101,140));
      //update the physics at the same rate as the render
       float fps = (float) driver->getFPS();
       if (fps > 0.0f)
           NewtonUpdate(nWorld, 1.0f / fps);
      // rotate node
      core::matrix4 mat;
      NewtonBodyGetMatrix(beat_Body, &mat.M[0]);
      //Set node position
      beat->setPosition(mat.getTranslation() * NewtonToIrr);
      // set node rotation
      core::vector3df euler;
      NewtonGetEulerAngle ( &mat.M[0], &euler.X);
      beat->setRotation(euler * (180.0f / 3.1416f));
      smgr->drawAll();
      driver->endScene();

      int fps_int = driver->getFPS();
      if (lastFPS  != fps_int)
      {
         core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
         str += driver->getName();
         str += "] FPS:";     str += fps_int;
         device->setWindowCaption(str.c_str());
         lastFPS = fps_int;
      }
   }

    // instead call
    NewtonDestroyAllBodies (nWorld);
    // finish newton & irrlicht
    NewtonDestroy(nWorld);
   device->drop();
   return 0;
}



j'utilise irrlicht 1.8 et newton 2.25

voila merci d'avance.

Hors ligne


#1 

01-12-2010 21:51:11

nabouill
Abonné
Date d'inscription: 17-09-2009
Messages: 242
Corrections: 1

j'ai l'impression que Newton n'est pas bien initialisé. Dans mes test avec Newton j'avais plutôt un truc du genre:

Code c++ :


              NewtonWorld* World;
    World = NewtonCreate();
    NewtonSetPlatformArchitecture(World, 0);

    dVector minSize(-500.0f, -500.0f, -500.0f);
    dVector maxSize(500.0f, 500.0f, 500.0f);
    NewtonSetWorldSize(World, &minSize[0], &maxSize[0]);
    NewtonSetSolverModel(World, 1);



Aussi, Irrlicht 1.8 est un peu buger, il serait peut-être pas mal d'essayer avec le version 1.7.2 au cas où.

@+


mes sites: www.manga-vf.fr et www.series-vf.fr

Hors ligne


#2 

02-12-2010 20:21:11

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

Non le programme veut toujours pas se lancer ...

Hors ligne


#3 

02-12-2010 21:18:51

TUpac
Habitué
Date d'inscription: 08-09-2009
Messages: 387
Corrections: 1

tu n'as pas un debugger pour localiser le problème stp?
décortiquer des heures ça fatigue vite ...


"Si vous ne partagez pas votre stabilité avec les pauvres, les pauvres partageront leur instabilité avec vous."

Hors ligne


#4 

02-12-2010 22:37:06

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

heu j'ai lancer le débugger mais le programme se lance et se ferme et il fait comme si il n'y avait pas de problème

Hors ligne


#5 

03-12-2010 09:51:41

nabouill
Abonné
Date d'inscription: 17-09-2009
Messages: 242
Corrections: 1

Tu utilise quel compilateur ?
Quel lib de Newton (il y en a au moin 8 différentes) ?
Utilise tu la bonne DLL qui correspond à la lib que tu as linker (question con peut-être, mais desfois une faute d'inatention...) ?


mes sites: www.manga-vf.fr et www.series-vf.fr

Hors ligne


#6 

03-12-2010 10:22:49

TUpac
Habitué
Date d'inscription: 08-09-2009
Messages: 387
Corrections: 1

As tu bien utiliser la lib debug de irrlicht et newton ?


"Si vous ne partagez pas votre stabilité avec les pauvres, les pauvres partageront leur instabilité avec vous."

Hors ligne


#7 

03-12-2010 10:29:26

kiricou974
Membre
Date d'inscription: 18-10-2010
Messages: 34

j'utilise le compilo de code block (mingw je crois mais pas sur) ensuite j'utilise la lib de vs9.
je vais voir si c'est un problème qui vient de la ou pas.



finalement sa venait effectivement de la ... galérer 3jours pour finalement une erreur de lib ... enfin bref merci a vous.

Hors ligne


Options Liens officiels Caractéristiques Statistiques Communauté
Corrections
irrlicht
irrklang
irredit
irrxml
xhtml 1.0
css 2.1
Propulsé par FluxBB
Traduit par FluxBB.fr
881 membres
1427 sujets
11117 messages
Dernier membre inscrit: Bidule
24 invités en ligne
Aucun membre connecté
RSS Feed