IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ogre Discussion :

Message erreur Compilation Release


Sujet :

Ogre

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut Message erreur Compilation Release
    Salut,

    Un message d'erreur s'affiche quand j'exécute le fichier .exe du mode release (compilation) sous VC++ 2005.

    voici l'erreur :


    Note: l'exécutable du mode Debug fonctionne sur mon pc sans problème.

    besoin d'aide, pour fonctionner l'application sur d'autres machines.

    S'il y a une autre méthode pour l'exportation de l'exécutable, n'hésiter pas de la poster


    a+

  2. #2
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Est-ce que tu ne mixerais pas 2 versions de Ogre?

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut Non, j'utilise Ogre 1.4.6
    Merci pour la réponse rapide,

    non j ai une seule version de Ogre installé sur mon pc, c'est la version 1.4.6

    besoin d'aide

  4. #4
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    a tu bien pris la 1.4.6 pour Visual Studio 2005 et pas pour le 2008?Essay de réinstaller Ogre si tu veu mon avis.

  5. #5
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut ok
    ok

  6. #6
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut solution du second erreur
    t as raison pour les deux version !!!


    j ai utilisé un ogremain.dll du répertoire demo, donc je l ai changé par le ogremain.dll de la version 1.4.6

    mais un nouveau message d'erreur :




    solution ????????????

  7. #7
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Est-ce que c'est une demo ou un programme maison?si c'est un programme maison,verifie que tu n'essay pas de détruire(delete) un objet de Ogre(une entitée ou autre)apres avoir fermer Ogre(delete Root).Sinon,et bien je sais pas trop.

  8. #8
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut re
    c'est un programme de maison, et je veux le partager mais j'arrive pas

  9. #9
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Ce qui serait surtout interresssant de voir,c'est le destructeur.Tu doit essayer de suprimer un objet qui l'est dejas si tu veu mon avis(quand tu fait delete sur Root,tu suprimme tout les composants de Ogre,entité,scenemanger,etc).

  10. #10
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut re
    le problème c est pas au niveau destructeur , parce que le message s affiche juste après le double click sur .exe, donc au démarrage !!!



    aide !........

  11. #11
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut wèè
    Voila j ai trouvé l'origine de l'erreur , c est plugin.cfg qui fait appel au fichier dll du mode debug.

    ce message d erreur disparait mais deux nouveaux apparaissent :

    le premier :


    le second :



    alors, besoin d'aide !!!!!!

  12. #12
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    t'a la poisse toi^^

    Pour le premier,je dirais la même chose,verifie que tu mixe pas 2 versions(recompile),pour le desieme,enleve la ligne qui parle du BSPSceneManager dans Plugins.cfg

  13. #13
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut merci
    merci , sa fonctionne mnt,

    je vois la fenetre de configuration de ogre (choix de résolution , direct3D ou openGL ...)

    mais ensuite un ecran noir s'affiche et disparait ... c koi le prob ??

    Edit 1 : voici une capture d'écran du mode debug :

  14. #14
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    On peut voir Ogre.log?

  15. #15
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6

  16. #16
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Est-ce qu'on peut voir ta fonction qui initialise Ogre?

  17. #17
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut re
    alors, t as trouvé une solution ???

    edit1 : j ai rien dis

    edit2 : OK

  18. #18
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut
    voici le premier fichier BaseApplication.cpp :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    /*
    -----------------------------------------------------------------------------
    Filename:    BaseApplication.cpp
    -----------------------------------------------------------------------------
    */
    #include "BaseApplication.h"
    #include "LoadingBar.h"
     
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #include "../res/resource.h"
    #endif
     
    template<> BaseApplication* Ogre::Singleton<BaseApplication>::ms_Singleton = 0;
     
    CEGUI::MouseButton convertOISMouseButtonToCegui(int buttonID)
    {
        switch (buttonID)
        {
    	case 0: return CEGUI::LeftButton;
    	case 1: return CEGUI::RightButton;
    	case 2:	return CEGUI::MiddleButton;
    	case 3: return CEGUI::X1Button;
    	default: return CEGUI::LeftButton;
        }
    }
     
    //-------------------------------------------------------------------------------------
    BaseApplication::BaseApplication(void)
    	: mRoot(0),
    	mCamera(0),
    	mSceneMgr(0),
    	mWindow(0),
    	mLoadingBar(0),
    	mGUISystem(0),
    	mGUIRenderer(0),
    	mShutdownRequested(false),
    	mSceneDetailIndex(0),
    	mMoveSpeed(100),
    	mRotateSpeed(36),
    	mDebugOverlay(0),
    	mDebugText(""),
    	mInputManager(0),
    	mMouse(0),
    	mKeyboard(0),
    	mTranslateVector(Vector3::ZERO),
    	mStatsOn(true),
    	mUseBufferedInputKeys(false),
    	mUseBufferedInputMouse(false),
    	mInputTypeSwitchingOn(false),
    	mNumScreenShots(0),
    	mMoveScale(0.0f),
    	mRotScale(0.0f),
    	mTimeUntilNextToggle(0),
    	mRotX(0),
    	mRotY(0),
    	mFiltering(TFO_BILINEAR),
    	mAniso(1)
    {
    }
     
    //-------------------------------------------------------------------------------------
    BaseApplication::~BaseApplication(void)
    {
    	//Remove ourself as a Window listener
    	WindowEventUtilities::removeWindowEventListener(mWindow, this);
    	windowClosed(mWindow);
    	if(mGUISystem)
    	{
    		delete mGUISystem;
    		mGUISystem = 0;
    	}
    	if(mGUIRenderer)
    	{
    		delete mGUIRenderer;
    		mGUIRenderer = 0;
    	}
    	delete mRoot;
    }
     
    //-------------------------------------------------------------------------------------
    bool BaseApplication::configure(void)
    {
    	// Show the configuration dialog and initialise the system
    	// You can skip this and use root.restoreConfig() to load configuration
    	// settings if you were sure there are valid ones saved in ogre.cfg
    		if(mRoot->showConfigDialog())
    		{
    		// If returned true, user clicked OK so initialise
    		// Here we choose to let the system create a default rendering window by passing 'true'
    		//mRoot->restoreConfig();
    		mWindow = mRoot->initialise(true);
    		// Let's add a nice window icon
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    		HWND hwnd;
    		mWindow->getCustomAttribute("WINDOW", (void*)&hwnd);
    		LONG iconID   = (LONG)LoadIcon( GetModuleHandle(0), MAKEINTRESOURCE(IDI_APPICON) );
    		SetClassLong( hwnd, GCL_HICON, iconID );
    #endif
    		return true;
    	}
    	else
    	{
    		return false;
    	}
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::chooseSceneManager(void)
    {
    	// Get the SceneManager, in this case a generic one
    	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::createCamera(void)
    {
    	// Create the camera
    	mCamera = mSceneMgr->createCamera("PlayerCam");
     
    	// Position it at 500 in Z direction
    	mCamera->setPosition(Vector3(0,5,12));
    	// Look back along -Z
    	mCamera->lookAt(Vector3(0,0,-20));
    	mCamera->setNearClipDistance(5);
     
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::createFrameListener(void)
    {
    	mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
    	mUseBufferedInputKeys = false;
    	mUseBufferedInputMouse = true;
    	mInputTypeSwitchingOn = mUseBufferedInputKeys || mUseBufferedInputMouse;
    	mRotateSpeed = 36;
    	mMoveSpeed = 100;
     
    	using namespace OIS;
     
    	LogManager::getSingletonPtr()->logMessage("*** Initialisation OIS ***");
    	ParamList pl;
    	size_t windowHnd = 0;
    	std::ostringstream windowHndStr;
     
    	mWindow->getCustomAttribute("WINDOW", &windowHnd);
    	windowHndStr << windowHnd;
    	pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
     
    	mInputManager = InputManager::createInputSystem( pl );
     
    	mKeyboard = static_cast<Keyboard*>(mInputManager->createInputObject( OISKeyboard, mUseBufferedInputKeys ));
    	mMouse = static_cast<Mouse*>(mInputManager->createInputObject( OISMouse, mUseBufferedInputMouse ));
     
    	mMouse->setEventCallback(this);
    	mKeyboard->setEventCallback(this);
     
    	mShutdownRequested = false;
    	//Set initial mouse clipping size
    	windowResized(mWindow);
     
    	//Register as a Window listener
    	WindowEventUtilities::addWindowEventListener(mWindow, this);
     
    	mStatsOn = true;
    	mNumScreenShots = 0;
    	mTimeUntilNextToggle = 0;
    	mSceneDetailIndex = 0;
    	mMoveScale = 0.0f;
    	mRotScale = 0.0f;
    	mTranslateVector = Vector3::ZERO;
    	mAniso = 1;
    	mFiltering = TFO_BILINEAR;
     
    	showDebugOverlay(true);
    	mRoot->addFrameListener(this);
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::destroyScene(void)
    {
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::createViewports(void)
    {
    	// Create one viewport, entire window
    	Viewport* vp = mWindow->addViewport(mCamera);
    	vp->setBackgroundColour(ColourValue(0,0,0));
     
    	// Alter the camera aspect ratio to match the viewport
    	mCamera->setAspectRatio(
    		Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::setupResources(void)
    {
    	// Load resource paths from config file
    	ConfigFile cf;
    	cf.load("./resources.cfg");
     
    	// Go through all sections & settings in the file
    	ConfigFile::SectionIterator seci = cf.getSectionIterator();
     
    	String secName, typeName, archName;
    	while (seci.hasMoreElements())
    	{
    		secName = seci.peekNextKey();
    		ConfigFile::SettingsMultiMap *settings = seci.getNext();
    		ConfigFile::SettingsMultiMap::iterator i;
    		for (i = settings->begin(); i != settings->end(); ++i)
    		{
    			typeName = i->first;
    			archName = i->second;
    			ResourceGroupManager::getSingleton().addResourceLocation(
    				archName, typeName, secName);
    		}
    	}
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::createResourceListener(void)
    {
     
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::loadResources(void)
    {
    	mLoadingBar = new LoadingBar();
     
    	mLoadingBar->start(mWindow, 1, 1, 0.75);
     
    	// Turn off rendering of everything except overlays
    	mSceneMgr->clearSpecialCaseRenderQueues();
    	mSceneMgr->addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
    	mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
     
    	// Initialise the rest of the resource groups, parse scripts etc
    	ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    	ResourceGroupManager::getSingleton().loadResourceGroup(
    		ResourceGroupManager::getSingleton().getWorldResourceGroupName(),
    		false, true);
     
    	// Back to full rendering
    	mSceneMgr->clearSpecialCaseRenderQueues();
    	mSceneMgr->setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
     
    	mLoadingBar->finish();
    	delete mLoadingBar;
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::go(void)
    {
    	if (!setup())
    		return;
     
    	showDebugOverlay(true);
     
    	mRoot->startRendering();
     
    	// clean up
    	destroyScene();
    }
    //-------------------------------------------------------------------------------------
    bool BaseApplication::setup(void)
    {
    	mRoot = new Root();
     
    	setupResources();
     
    	bool carryOn = configure();
    	if (!carryOn) return false;
     
    	chooseSceneManager();
    	createCamera();
    	createViewports();
     
    	// Set default mipmap level (NB some APIs ignore this)
    	TextureManager::getSingleton().setDefaultNumMipmaps(5);
     
    	// Create any resource listeners (for loading screens)
    	createResourceListener();
    	// Load resources
    	loadResources();
     
    	// Create the scene
    	createScene();
     
    	createFrameListener();
     
    	return true;
    };
    //-------------------------------------------------------------------------------------
    void BaseApplication::updateStats(void)
    {
    	static String currFps = "FPS en cours : ";
    	static String avgFps = "Moyenne FPS : ";
    	static String bestFps = "Meilleur FPS : ";
    	static String worstFps = "Basse FPS : ";
    	static String tris = "Nombre de triangles : ";
     
    	// update stats when necessary
    	try {
    		OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
    		OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
    		OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
    		OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
     
    		const RenderTarget::FrameStats& stats = mWindow->getStatistics();
     
    		guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
    		guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
    		guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
    			+" "+StringConverter::toString(stats.bestFrameTime)+" ms");
    		guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
    			+" "+StringConverter::toString(stats.worstFrameTime)+" ms");
     
    		OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
    		guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
     
    		OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
    		guiDbg->setCaption(mDebugText);
    	}
    	catch(...)
    	{
    		// ignore
    	}
    }
    //-------------------------------------------------------------------------------------
    bool BaseApplication::processUnbufferedKeyInput(const FrameEvent& evt)
    {
    	using namespace OIS;
    	OIS::Keyboard* mInputDevice = mKeyboard; // Nice hack, eh? :)
     
    	if (mInputDevice->isKeyDown(KC_A))
    	{
    		// Move camera left
    		mTranslateVector.x = -mMoveScale;
    	}
     
    	if (mInputDevice->isKeyDown(KC_D))
    	{
    		// Move camera RIGHT
    		mTranslateVector.x = mMoveScale;
    	}
     
    	/* Move camera forward by keypress. */
    	if (mInputDevice->isKeyDown(KC_UP) || mInputDevice->isKeyDown(KC_W) )
    	{
    		mTranslateVector.z = -mMoveScale;
     
    	}
     
    	/* Move camera backward by keypress. */
    	if (mInputDevice->isKeyDown(KC_DOWN) || mInputDevice->isKeyDown(KC_S) )
    	{
    		mTranslateVector.z = mMoveScale;
    	}
     
    	if (mInputDevice->isKeyDown(KC_PGUP))
    	{
    		// Move camera up
    		mTranslateVector.y = mMoveScale;
    	}
     
    	if (mInputDevice->isKeyDown(KC_PGDOWN))
    	{
    		// Move camera down
    		mTranslateVector.y = -mMoveScale;
    	}
     
    	if (mInputDevice->isKeyDown(KC_RIGHT))
    	{
    		mCamera->yaw(-mRotScale);
    	}
     
    	if (mInputDevice->isKeyDown(KC_LEFT))
    	{
    		mCamera->yaw(mRotScale);
    	}
     
    	if( mInputDevice->isKeyDown( KC_ESCAPE) )
    	{
    		return false;
    	}
     
    	// see if switching is on, and you want to toggle
    	if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0)
    	{
    		switchMouseMode();
    		mTimeUntilNextToggle = 1;
    	}
     
    	if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_K) && mTimeUntilNextToggle <= 0)
    	{
    		// must be going from immediate keyboard to buffered keyboard
    		switchKeyMode();
    		mTimeUntilNextToggle = 1;
    	}
    	if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0)
    	{
    		mStatsOn = !mStatsOn;
    		showDebugOverlay(mStatsOn);
     
    		mTimeUntilNextToggle = 1;
    	}
    	if (mInputDevice->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0)
    	{
    		switch(mFiltering)
    		{
    		case TFO_BILINEAR:
    			mFiltering = TFO_TRILINEAR;
    			mAniso = 1;
    			break;
    		case TFO_TRILINEAR:
    			mFiltering = TFO_ANISOTROPIC;
    			mAniso = 8;
    			break;
    		case TFO_ANISOTROPIC:
    			mFiltering = TFO_BILINEAR;
    			mAniso = 1;
    			break;
    		default:
    			break;
    		}
    		MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
    		MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
     
     
    		showDebugOverlay(mStatsOn);
     
    		mTimeUntilNextToggle = 1;
    	}
     
    	if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
    	{
    		std::ostringstream ss;
    		ss << "CaptureEcran_" << ++mNumScreenShots << ".png";
    		mWindow->writeContentsToFile(ss.str());
    		mTimeUntilNextToggle = 0.5;
    		mDebugText = "Enregistré: " + ss.str();
    	}
     
    	if (mInputDevice->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
    	{
    		mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
    		switch(mSceneDetailIndex) {
    				case 0 : mCamera->setPolygonMode(PM_SOLID) ; break ;
    				case 1 : mCamera->setPolygonMode(PM_WIREFRAME) ; break ;
    				case 2 : mCamera->setPolygonMode(PM_POINTS) ; break ;
    		}
    		mTimeUntilNextToggle = 0.5;
    	}
     
    	static bool displayCameraDetails = false;
    	if (mInputDevice->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
    	{
    		displayCameraDetails = !displayCameraDetails;
    		mTimeUntilNextToggle = 0.5;
    		if (!displayCameraDetails)
    			mDebugText = "";
    	}
    	if (displayCameraDetails)
    	{
    		// Print camera details
    		mDebugText = "P: " + StringConverter::toString(mCamera->getDerivedPosition()) +
    			" " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation());
    	}
     
    	// Return true to continue rendering
    	return true;
    }
    //-------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------
    bool BaseApplication::processUnbufferedMouseInput(const FrameEvent& evt)
    {
    	using namespace OIS;
     
    	// Rotation factors, may not be used if the second mouse button is pressed
    	// 2nd mouse button - slide, otherwise rotate
    	const MouseState &ms = mMouse->getMouseState();
    	if( ms.buttonDown( MB_Right ) )
    	{
    		mTranslateVector.x += ms.X.rel * 0.13;
    		mTranslateVector.y -= ms.Y.rel * 0.13;
    	}
    	else
    	{
    		mRotX = Degree(-ms.X.rel * 0.13);
    		mRotY = Degree(-ms.Y.rel * 0.13);
    	}
     
    	return true;
    }
    //-------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------
    void BaseApplication::moveCamera()
    {
     
    	// Make all the changes to the camera
    	// Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW (e.g. airplane)
     
     
    	mCamera->yaw(mRotX);
    	mCamera->pitch(mRotY);
    	mCamera->moveRelative(mTranslateVector);
     
     
    }
    //-------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------
    void BaseApplication::showDebugOverlay(bool show)
    {
    	if (mDebugOverlay)
    	{
    		if (show)
    		{
    			mDebugOverlay->show();
    		}
    		else
    		{
    			mDebugOverlay->hide();
    		}
    	}
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::requestShutdown(void)
    {
    	mShutdownRequested = true;
    }
    //-------------------------------------------------------------------------------------
    bool BaseApplication::frameStarted(const FrameEvent& evt)
    {
    	if(mWindow->isClosed())
    		return false;
     
    	//Need to capture/update each device
    	mKeyboard->capture();
    	mMouse->capture();
     
    	mUseBufferedInputMouse = mMouse->buffered();
    	mUseBufferedInputKeys = mKeyboard->buffered();
     
     
          if(mUseBufferedInputMouse)
          {
             CEGUI::MouseCursor::getSingleton().show( );
          }
          else
          {
             CEGUI::MouseCursor::getSingleton().hide( );
          }
     
    	if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
    	{
    		// one of the input modes is immediate, so setup what is needed for immediate mouse/key movement
    		if (mTimeUntilNextToggle >= 0)
    			mTimeUntilNextToggle -= evt.timeSinceLastFrame;
     
    		// If this is the first frame, pick a speed
    		if (evt.timeSinceLastFrame == 0)
    		{
    			mMoveScale = 1;
    			mRotScale = 0.1;
    		}
    		// Otherwise scale movement units by time passed since last frame
    		else
    		{
    			// Move about 100 units per second,
    			mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;
    			// Take about 10 seconds for full rotation
    			mRotScale = mRotateSpeed * evt.timeSinceLastFrame;
    		}
    		mRotX = 0;
    		mRotY = 0;
    		mTranslateVector = Vector3::ZERO;
    	}
     
    	if (mUseBufferedInputKeys)
    	{
    		// no need to do any processing here, it is handled by event processor and
    		// you get the results as KeyEvents
    	}
    	else
    	{
    		if (processUnbufferedKeyInput(evt) == false)
    		{
    			return false;
    		}
    	}
    	if (mUseBufferedInputMouse)
    	{
    		// no need to do any processing here, it is handled by event processor and
    		// you get the results as MouseEvents
    	}
    	else
    	{
    		if (processUnbufferedMouseInput(evt) == false)
    		{
    			return false;
    		}
    	}
     
    	if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
    	{
    		// one of the input modes is immediate, so update the movement vector
     
    		moveCamera();
     
    	}
     
    	return true;
    }
    //-------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------
    bool BaseApplication::frameEnded(const FrameEvent& evt)
    {
    	if (mShutdownRequested)
    		return false;
    	updateStats();
    	return true;
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::switchMouseMode()
    {
    	mUseBufferedInputMouse = !mUseBufferedInputMouse;
    	mMouse->setBuffered(mUseBufferedInputMouse);
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::switchKeyMode()
    {
    	mUseBufferedInputKeys = !mUseBufferedInputKeys;
    	mKeyboard->setBuffered(mUseBufferedInputKeys);
    }
    //-------------------------------------------------------------------------------------
    //-------------------------------------------------------------------------------------
    bool BaseApplication::keyPressed( const OIS::KeyEvent &arg )
    {
    	if( arg.key == OIS::KC_ESCAPE )
    		mShutdownRequested = true;
    	CEGUI::System::getSingleton().injectKeyDown( arg.key );
    	CEGUI::System::getSingleton().injectChar( arg.text );
    	return true;
    }
     
    bool BaseApplication::keyReleased( const OIS::KeyEvent &arg )
    {
    	if( arg.key == OIS::KC_M )
    		mMouse->setBuffered( !mMouse->buffered() );
    	else if( arg.key == OIS::KC_K )
    		mKeyboard->setBuffered( !mKeyboard->buffered() );
    		CEGUI::System::getSingleton().injectKeyUp( arg.key );
    	return true;
    }
     
    bool BaseApplication::mouseMoved( const OIS::MouseEvent &arg )
    {
    	CEGUI::System::getSingleton().injectMouseMove( arg.state.X.rel, arg.state.Y.rel );
    	return true;
    }
     
    bool BaseApplication::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
    {
    	CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id));
    	return true;
    }
     
    bool BaseApplication::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
    {
    	CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id));
    	return true;
    }
     
    //Adjust mouse clipping area
    void BaseApplication::windowResized(RenderWindow* rw)
    {
    	unsigned int width, height, depth;
    	int left, top;
    	rw->getMetrics(width, height, depth, left, top);
     
    	const OIS::MouseState &ms = mMouse->getMouseState();
    	ms.width = width;
    	ms.height = height;
    }
     
    //Unattach OIS before window shutdown (very important under Linux)
    void BaseApplication::windowClosed(RenderWindow* rw)
    {
    	//Only close for window that created OIS (the main window in these demos)
    	if( rw == mWindow )
    	{
    		if( mInputManager )
    		{
    			mInputManager->destroyInputObject( mMouse );
    			mInputManager->destroyInputObject( mKeyboard );
     
    			OIS::InputManager::destroyInputSystem(mInputManager);
    			mInputManager = 0;
    		}
    	}
    }
    //-------------------------------------------------------------------------------------
    void BaseApplication::setupEventHandlers(void)
    {
    }
    //-------------------------------------------------------------------------------------
    bool BaseApplication::handleQuit(const CEGUI::EventArgs& e)
    {
    	requestShutdown();
    	return true;
    }
    le second : highwaystorys.cpp

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    /*
    -----------------------------------------------------------------------------
    Filename:    HighwayStorys.cpp
    ----------------------------------------------------------------------------
    */
    #include "HighwayStorys.h"
    #include "vehicule.h"
    #include "textOgre.h"
    //-------------------------------------------------------------------------------------
    HighwayStorysApp::HighwayStorysApp(void)
    {
    }
    //-------------------------------------------------------------------------------------
    HighwayStorysApp::~HighwayStorysApp(void)
    {
    }
     
    //-------------------------------------------------------------------------------------
    void HighwayStorysApp::createScene(void)
    {
    	// setup GUI system
    	mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow,Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
    	mGUISystem = new CEGUI::System(mGUIRenderer);
    	CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
    	// load scheme and set up defaults
    	CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
    	mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
    	mGUISystem->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");
    	CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
    	CEGUI::MouseCursor::getSingleton().show( );
    	setupEventHandlers();
     
    	mSceneMgr->setSkyBox( true, "Examples/MorningSkyBox");
     
    	//Vehicule :
    	vehicule *v1 = new vehicule("Ford.Vehicule","ford_gran_torino.mesh",0.,0.8+.8,0.6+.2,3,3,3,0,0);//"Ford.Vehicule","body_a_BODY.mesh",0.,0.8+.8,0.6+.2,.02,.02,.02,90,-90
    	v1->ajouterVehicule(mSceneMgr);
     
    	//Ajouter un texte :
    	OgreText *letexte;
    	letexte=new OgreText();
    	letexte->setTextstring("www.achrafothman.com");
    	letexte->setPos(200,200);
    	letexte->setCol(0.10f,1.0f,0.0f,0.5f);
     
    	// Track :
    	Entity* track = mSceneMgr->createEntity("track01", "grand_prix_track.mesh");
    	SceneNode* headNodeTrack = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    	track->setNormaliseNormals(true); // need to do for lights after scalling
        headNodeTrack->setPosition(Vector3(0.,0.,0.6+.2));
    	headNodeTrack->attachObject(track);
     
    	// Set ambient light
    	mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
     
    	// Create a light
    	Light* l = mSceneMgr->createLight("MainLight");
    	l->setPosition(20,80,50);
    }
     
     
     
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #define WIN32_LEAN_AND_MEAN
    #include "windows.h"
    #endif
     
    #ifdef __cplusplus
    	extern "C" {
    #endif
     
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    		INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
    #else
    		int main(int argc, char *argv[])
    #endif
    		{
    			// Create application object
    			HighwayStorysApp app;
     
    			try {
    				app.go();
    			} catch( Ogre::Exception& e ) {
    #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    				MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
    #else
    				std::cerr << "An exception has occured: " <<
    					e.getFullDescription().c_str() << std::endl;
    #endif
    			}
     
    			return 0;
    		}
     
    #ifdef __cplusplus
    	}
    #endif

    besoin d'aide ...

  19. #19
    Membre confirmé
    Avatar de gusgus
    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    500
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 500
    Points : 641
    Points
    641
    Par défaut
    Essay d'initialiser les ressources apres avoir créer le scenemanager et la camera.Sa donnerais sa:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    bool BaseApplication::setup(void)
    {
    	mRoot = new Root();
     
    	bool carryOn = configure();
    	if (!carryOn) return false;
     
    	chooseSceneManager();
    	createCamera();
    	createViewports();
     
            setupResources();

  20. #20
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    23
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2007
    Messages : 23
    Points : 6
    Points
    6
    Par défaut re - merci - prob
    merci pour la réponse , mais le même problème

    une fenêtre noire s'affiche et disparait !!! càd le même problème.

    Si ça ne te dérange pas , on peut se discuter par msn , sa sera mieux a mon avis !! ???

Discussions similaires

  1. [Objective-C] incompréhension message erreur compilation
    Par flo21470 dans le forum Objective-C
    Réponses: 12
    Dernier message: 11/10/2011, 12h41
  2. [D2010] Message d'erreur compilation paquet
    Par brouce dans le forum EDI
    Réponses: 3
    Dernier message: 07/10/2010, 11h28
  3. message d'erreur compilation
    Par Nayra dans le forum Débuter avec Java
    Réponses: 10
    Dernier message: 17/07/2008, 07h44
  4. Message erreur compilation
    Par Telemak dans le forum NetBeans
    Réponses: 2
    Dernier message: 22/12/2007, 22h19
  5. Trop de message d'erreurs: compilation KO
    Par jeannot27 dans le forum C++Builder
    Réponses: 6
    Dernier message: 21/01/2004, 16h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo