xboxscene.org forums

OG Xbox Forums => Software Forums => Development => Topic started by: JbOnE on September 10, 2005, 03:36:00 PM

Title: Help My Project Builds....but
Post by: JbOnE on September 10, 2005, 03:36:00 PM
from a quick glance it looks like it should be showing on screen - i myself never really went with using pretransformed matrices, but just cuz you don't see it - doesn't mean it's not there smile.gif try using xray debug tool (it's in 5933), play with modes and see if the invisible triangle doesn't just miraculously appear after altering a setting. it's a really nice tool to use for just such a debug problem wink.gif

J
Title: Help My Project Builds....but
Post by: ColdReader on September 10, 2005, 06:09:00 PM
the app say's my app isnt debug but in my configuration it's set to Debug do you have any kind of instant messenger? if you do can you PM me ur handle? thanks Jbone
Title: Help My Project Builds....but
Post by: fghjj on September 10, 2005, 09:03:00 PM
add
CODE
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);

to end of loop
Title: Help My Project Builds....but
Post by: ColdReader on September 11, 2005, 03:21:00 AM
ok please dont hurt me since i made this topic yesterday i figured i'd post my current problem



#include <xtl.h>
#include <assert.h>
#include <dsstdfx.h>
#include <xact.h>
#include <vector>
#include <Dmusici.h>


LPDIRECT3D8 g_pD3D = NULL;                      // DirectX Object
LPDIRECT3DDEVICE8 g_pD3DDevice = NULL;          // Screen Object
IDirectMusicLoader8* g_pLoader = NULL;
IDirectMusicPerformance8* g_pPerformance = NULL;
IDirectMusicSegment8* g_pSegment = NULL;

void audinit()
{
   g_pPerformance->InitAudioX( DMUS_APATH_DYNAMIC_3D, 64, NULL, NULL );

   g_pSegment->Download( g_pPerformance );
   
    // Tell DirectMusic where the default search path is
   g_pPerformance->SetDefaultAudioPath( IDirectMusicAudioPath ("E:\\samples\\media\\"));
}

void audplay()
{
      g_pPerformance->PlaySegmentEx(
      g_pSegment,
      NULL,
      NULL,
      0,
      0,
      NULL,
      NULL,
      NULL
   );
}

void InitialiseD3D()
{

    g_pD3D = Direct3DCreate8(D3D_SDK_VERSION);

    //Create a structure to hold the settings for our device
    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory(&d3dpp, sizeof(d3dpp));

    //Fill the structure.
    // Set fullscreen 640x480x32 mode
      d3dpp.BackBufferWidth = 640;
      d3dpp.BackBufferHeight = 480;
      d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;

   
      d3dpp.BackBufferCount = 1;

     
      d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

   
    g_pD3D->CreateDevice(0, D3DDEVTYPE_HAL, NULL,
                                   D3DCREATE_HARDWARE_VERTEXPROCESSING,
                                                   &d3dpp, &g_pD3DDevice);
}
void CleanUp()
{
    g_pD3DDevice->Release();
    g_pD3D->Release();
}


LPDIRECT3DVERTEXBUFFER8 g_pVertexBuffer = NULL;
struct CUSTOMVERTEX
{
    FLOAT x, y, z, rhw;
    DWORD colour;
};
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
void DrawTriangle()
{
    VOID* pVertices;

   
    CUSTOMVERTEX cvVertices[] =
    {
        {250.0f, 100.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0),}, //Vertex 1 - Red (250, 100)
        {400.0f, 350.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 2 - Green (400, 350)
        {100.0f, 350.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 3 - Blue (100, 350)
    };


    g_pD3DDevice->CreateVertexBuffer(3 * sizeof(CUSTOMVERTEX),
0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVertexBuffer);

 
    g_pVertexBuffer->Lock(0, sizeof(cvVertices), (BYTE**)&pVertices, 0);

    memcpy(pVertices, cvVertices, sizeof(cvVertices));


    g_pVertexBuffer->Unlock();

   
    g_pD3DDevice->SetStreamSource(0, g_pVertexBuffer, sizeof(CUSTOMVERTEX));
    g_pD3DDevice->SetVertexShader(D3DFVF_CUSTOMVERTEX);
    g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

             
             g_pVertexBuffer->Release();
}




void _cdecl main()
{
   audinit();
   InitialiseD3D();

   while(true)
   {
      g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);

      g_pD3DDevice->BeginScene();

      DrawTriangle();
            

      g_pD3DDevice->EndScene();
      g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
               
      audplay();
   }
   CleanUp();
}

ok when i add those audio functions in my main loop it goes to a black screen when i launch my xbe and yes i know the includes above are for XACT but i've been experimenting all night with a way to play music and it seems my Direct Music isnt working i know somewhere i made a stupid mistake and the one who corrects my code will think im retarded but it's been a long night and im leaving this code to a proffesional to fix so i can learn from my mistakes  beerchug.gif