• Create Account

### #ActualNightCreature83

Posted 15 January 2013 - 06:16 AM

Yes because D3DXCOLOR defines a cast operator through which it can do this automatically. You just can't use sizeof(SpriteVertex) if you keep storing a D3DXCOLOR in there as the vertexdeclaration and stride won't match up.
Also you should find the D3D control panel and turn the debug layer on with messages set to warning, you will get warnings about this stuff in your output log this way. In the start menu folder where you found pix there is also something called DirectX Control panel launch that application and change the settings under Direct3D 9 tab to use the debug Version of the runtime. Move the slider, under the heading Debug Output Level, to one tick before More, click apply.

You also have to modify your vertex declaration to this when using only a dword to store your color values:

    //VERTEX DECLARATION

D3DVERTEXELEMENT9 Sprite_Decl[] =
{
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
{0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
{0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
D3DDECL_END() // this macro is needed as the last item!
};


### #1NightCreature83

Posted 15 January 2013 - 06:10 AM

Yes because D3DXCOLOR defines a cast operator through which it can do this automatically. You just can't use sizeof(SpriteVertex) if you keep storing a D3DXCOLOR in there as the vertexdeclaration and stride won't match up.

Also you should find the D3D control panel and turn the debug layer on with messages set to warning, you will get warnings about this stuff in your output log this way. In the start menu folder where you found pix there is also something called DirectX Control panel launch that application and change the settings under Direct3D 9 tab to use the debug mode of the runtime.

PARTNERS