Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#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