   D3DXSPRITE_DONOTMODIFY_RENDERSTATE help
  I make extensive use of the D3DXSPRITE interface throughout my engine. When calling the "d3dspt->Begin()" function I've been using the "D3DXSPRITE_ALPHABLEND" flag. It's come to a point now though where I want to be able to change my renderstates during the d3dspt Begin() to End(). More specifically, I want to change the following at some point during the 2D sprite scene: d3ddev->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );d3ddev->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );Apparently I can pass in the "D3DXSPRITE_DONOTMODIFY_RENDERSTATE" flag into my d3dspt->Begin() parameters. So I changed the code to the following:// Begin sprite drawingd3dspt->Begin( D3DXSPRITE_DONOTMODIFY_RENDERSTATE ); // Set renderstatesd3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);d3ddev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);d3ddev->SetRenderState(D3DRS_ALPHAREF, (DWORD)8);d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); d3ddev->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );d3ddev->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );Since passing in this "D3DXSPRITE_DONOTMODIFY_RENDERSTATE" flag, nothing is rendered at all. I need to know what exactly D3DXSPRITE_ALPHABLEND does to the renderstates so I can copy it, so I can achieve the same with D3DXSPRITE_DONOTMODIFY_RENDERSTATE and be abl to change the renderstates after that. I've googled both flags trying to work it out but to no avail. I think it might be something to do with positioning? When I call a texture draw I have the following positioning code, which worked fine with D3DXSPRITE_ALPHABLEND:// Create transformation vectorsD3DXVECTOR2 center  ( (float)texcoords->wHalf, (float)texcoords->hHalf );D3DXVECTOR2 position( (float)x, (float)y );D3DXVECTOR2 scaling ( scaleX, scaleY );// Build matrix to rotate, scale and position the spritestatic D3DXMATRIX mat;// Set translationD3DXMatrixTransformation2D( &mat, NULL, 0.0, &scaling, &center, rotation, &position );// Tell the sprite about the matrixd3d->d3dspt->SetTransform(&mat);// Adjust z for z bufferD3DXVECTOR3 position2( 0.0f, 0.0f, z );// Render the textured3d->d3dspt->Draw( texture, &texcoords->rTrue, NULL, &position2, colorIn->getd3dcolor() );Please help!   
  You can use Pix to capture all of the state changes if you want to see what's changed by ID3DXSprite.It changes quite a few render states and transforms (Although I'm not sure what exactly). Is there a reason you don't want to just make your SetRenderState() calls after Begin()? That way they'll override those set by ID3DXSprite.   ;Quote:Original post by Evil SteveYou can use Pix to capture all of the state changes if you want to see what's changed by ID3DXSprite.It changes quite a few render states and transforms (Although I'm not sure what exactly). Is there a reason you don't want to just make your SetRenderState() calls after Begin()? That way they'll override those set by ID3DXSprite.Thanks for your reply, I wasn't aware that I could just set new renderstates AFTER the Begin() call, silly me. Thanks again!   