Thread: Invisible geometry :( D3D vertex prob?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72

    Invisible geometry :( D3D vertex prob?

    Hey, all im trying to do is make a simple cube in DirectX 9. However, despite it all compiling i have inivisble geometry. I have my lights switched on, materials set etc. So that leads me to think its a prob when I set my vertices, the code is:

    Code:
    bool CGfxEntityCube::Initialise()
    {
    gD3dDevice->CreateVertexBuffer(8*sizeof(CUBEVERTEX), D3DUSAGE_WRITEONLY, D3DFVF_CUBEVERTEX, D3DPOOL_MANAGED, &m_vb, NULL);
    
    CUBEVERTEX pVertices[]={{ 0.0, 0.0, 0.0,},
    						{ 0.0, 1.0, 0.0,},
    						{ 1.0, 0.0, 0.0,},
    						{ 1.0, 1.0, 0.0,},
    						{ 1.0, 0.0, 1.0,},
    						{ 1.0, 1.0, 1.0,},
    						{ 0.0, 0.0, 1.0,},
    						{ 0.0, 1.0, 1.0,}};
    
    VOID *vertices;
    
    m_vb->Lock(0, sizeof(pVertices), (void**)&vertices, 0);
    
    memcpy(vertices, pVertices, sizeof(pVertices));
    
    m_vb->Unlock();
    
    gD3dDevice->CreateIndexBuffer(36*3*2, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_ib, NULL);
    
    WORD pIndices[]={0, 1, 2,
    				 2, 1, 3,
    				 2, 3, 4,
    				 4, 3, 5,
    				 4, 5, 6,
    				 6, 5, 7,
    				 6, 7, 0,
    				 0, 7, 1,
    				 1, 7, 3,
    				 3, 7, 5,
    				 0, 2, 6,
    				 2, 4, 6};
    
    VOID *indices;
    
    m_ib->Lock(0, sizeof(pIndices), (void**)&indices, 0);
    
    memcpy(indices, pIndices, sizeof(pIndices));
    
    m_ib->Unlock();
    
    return TRUE;
    }
    Is that ok? any other ideas where im going wrong?

    All i want is a simple life, a life of OpenGL
    Last edited by gazsux; 04-05-2003 at 03:31 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error help making no sense
    By tunerfreak in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2007, 07:55 PM
  2. Total newb directx invisable geometry question
    By -pete- in forum Game Programming
    Replies: 5
    Last Post: 08-13-2006, 01:45 PM
  3. Implemented vertex arrays, prob. rendering
    By BobMcGee123 in forum Game Programming
    Replies: 8
    Last Post: 07-22-2006, 08:00 PM
  4. DX9 visualization problem
    By darcome in forum Game Programming
    Replies: 4
    Last Post: 03-05-2003, 12:40 PM
  5. Pixel Shaders.
    By Cheeze-It in forum Game Programming
    Replies: 1
    Last Post: 05-21-2002, 01:16 AM