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

DirectX Discussion :

Impossible de charger un mesh...


Sujet :

DirectX

  1. #1
    Membre régulier
    Inscrit en
    Janvier 2004
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 37

    Informations forums :
    Inscription : Janvier 2004
    Messages : 92
    Points : 70
    Points
    70
    Par défaut Impossible de charger un mesh...
    Salut, Je voudrais charger un mesh est l'afficher dans ma fenêtre mais j'ai une erreur. Dans l'aide du SDK il charge le mesh de cette façon
    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
    LPD3DXBUFFER pD3DXMtrlBuffer;
     
    // Load the mesh from the specified file
    if( FAILED( D3DXLoadMeshFromX( "Tiger.x", D3DXMESH_SYSTEMMEM, 
                g_pd3dDevice, NULL, &pD3DXMtrlBuffer, NULL,
    			&g_dwNumMaterials, &g_pMesh ) ) )
        {
        // If model is not in current folder, try parent folder
        if( FAILED( D3DXLoadMeshFromX( "..\\Tiger.x",      
                D3DXMESH_SYSTEMMEM, g_pd3dDevice, NULL, 
                &pD3DXMtrlBuffer, NULL, &g_dwNumMaterials, 
                &g_pMesh ) ) )
            {
                MessageBox(NULL, "Could not find tiger.x",
    			           "Meshes.exe", MB_OK);
                return E_FAIL;
            }
        }
    Cependent à la compilation j'ai des erreurs
    h:\c++\vs\directx\main.cpp(16) : error C2065: 'LPD3DXBUFFER' : undeclared identifier
    h:\c++\vs\directx\main.cpp(16) : error C2146: syntax error : missing ';' before identifier 'pD3DXMtrlBuffer'
    h:\c++\vs\directx\main.cpp(16) : error C2065: 'pD3DXMtrlBuffer' : undeclared identifier
    Il me manque un header ?
    Voila la source de ma fenêtre

    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
    #include "Windows.h"
    #include "D3D9.h"
    #include <mmsystem.h>
     
    LPDIRECT3D9 g_pD3D = NULL;
    LPDIRECT3DDEVICE9       g_pd3dDevice = NULL;
     
    LRESULT CALLBACK MainProc(HWND hWnd, UINT mes, WPARAM wParam, LPARAM lParam);
    HRESULT InitD3D(HWND hWnd);
    void rendu(void);
    void destruction(void);
    void viewport(void);
     
    int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
    {
    WNDCLASSEX fenetre;
    fenetre.cbSize=sizeof(WNDCLASSEX);
    fenetre.style=CS_HREDRAW|CS_VREDRAW;
    fenetre.lpfnWndProc=MainProc;
    fenetre.cbClsExtra=0;
       fenetre.cbWndExtra=0;
       fenetre.hInstance=hInstance;
       fenetre.hIcon=LoadIcon(NULL,IDI_APPLICATION);
       fenetre.hCursor=LoadCursor(NULL,IDC_ARROW);
       fenetre.hbrBackground=reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
       fenetre.lpszMenuName=NULL;
       fenetre.lpszClassName="std";
       fenetre.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
       RegisterClassEx(&fenetre);
     
    HWND hWnd;
    hWnd=CreateWindowEx( WS_EX_CLIENTEDGE,"std","fenêtre",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
          NULL,
          NULL,
          hInstance,
          NULL
       );
    if (SUCCEEDED (InitD3D(hWnd)))
    {
    ShowWindow(hWnd,SW_SHOW);
    UpdateWindow( hWnd );
     
    MSG msg; 
    while( GetMessage( &msg, NULL, 0, 0 ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
    }
     
    }
     
    LRESULT CALLBACK MainProc(HWND hWnd, UINT mes, WPARAM wParam, LPARAM lParam)
    {
       HDC hDC;
       PAINTSTRUCT paintst;
       switch (mes)
       {
       case WM_PAINT:
    	   rendu();
          hDC=BeginPaint(hWnd,&paintst);
          EndPaint(hWnd,&paintst);
          return 0;
       case WM_DESTROY:
          PostQuitMessage(0);
          return 0;
       default:
          return DefWindowProc(hWnd, mes, wParam, lParam);
       }
    }
     
    HRESULT InitD3D(HWND hWnd)
    {
    if (NULL == (g_pD3D = Direct3DCreate9( D3D_SDK_VERSION)))
    return E_FAIL;
     
    D3DPRESENT_PARAMETERS d3dpp; 
    ZeroMemory( &d3dpp, sizeof(d3dpp) );
    d3dpp.Windowed = true;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
     
     if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
                                          D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                          &d3dpp, &g_pd3dDevice ) ) )
        {
            return E_FAIL;
        }
     
    return S_OK;
    }
     
    void rendu(void)
    {
    if (NULL==g_pd3dDevice)
    return;
     
    g_pd3dDevice->Clear(0,NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
    if (SUCCEEDED (g_pd3dDevice->BeginScene()))
    {
    g_pd3dDevice->EndScene();
    }
    g_pd3dDevice->Present(NULL,NULL,NULL,NULL);
    }
     
    void destruction(void)
    {
     
        if( g_pd3dDevice != NULL) 
            g_pd3dDevice->Release();
     
        if( g_pD3D != NULL)
            g_pD3D->Release();
     
    }
     
    void viewport(void)
    {
     
    }

  2. #2
    Inactif  

    Homme Profil pro
    Ingénieur test de performance
    Inscrit en
    Décembre 2003
    Messages
    1 986
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur test de performance
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2003
    Messages : 1 986
    Points : 2 605
    Points
    2 605
    Par défaut
    #include "D3dx8core.h" et D3dx8.lib

  3. #3
    Membre régulier
    Inscrit en
    Janvier 2004
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 37

    Informations forums :
    Inscription : Janvier 2004
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    ok merci j'essaye sa demain.

Discussions similaires

  1. Impossible de charger LIBMYSQL.DLL
    Par Dalès dans le forum Bases de données
    Réponses: 19
    Dernier message: 20/09/2006, 04h57
  2. Impossible de charger des thémes
    Par unix27 dans le forum Autres Logiciels
    Réponses: 3
    Dernier message: 24/01/2006, 21h02
  3. [py2exe] Impossible de charger un module...
    Par Mr Hyde dans le forum Py2exe
    Réponses: 3
    Dernier message: 28/09/2005, 17h17
  4. Réponses: 19
    Dernier message: 09/09/2005, 16h44
  5. [SERVLET][JDBC] Impossible de charger les pilotes
    Par cedric.picard dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 07/10/2004, 14h11

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