   D3DXSprite and D3DXSPRITE_DONOTMODIFY_RENDERSTATE *solved*
  I am using C++ and Direct X9.I am drawing texture 'A' to the screen using DrawPrimitive() and texture 'B' to the screen using 3DXSprite. Both Textures appear if I do not pass D3DXSPRITE_DONOTMODIFY_RENDERSTATE. If I do pass D3DXSPRITE_DONOTMODIFY_RENDERSTATE, texture 'A' dissappears and texture 'B' is still drawn, however sometimes there are artifacts (like Z Fighting) that appears.renderstates does D3DXSprite need me to set when I pass D3DXSPRITE_DONOTMODIFY_RENDERSTATE? And do I have to set a FVF for the sprite, if so what type?Anyone able to help? What[Edited by - utilae on December 7, 2005 1:54:39 AM]
  Ok, I solved my problem.I had to set a fvf for the sprite and then when I am done set the fvf for my drawprimitive vertexes as well as the streamsource.Here's some code about drawing sprites and fonts://the line below helped solve my errorg_pD3DDevice9->SetFVF(g_dwFVFSprite);//g_dwFVFSprite=D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1//use my own renderstate, eg my own alpha testing, etcg_pSprite->Begin(D3DXSPRITE_DONOTMODIFY_RENDERSTATE);//loop through list of sprites and text to rendervector<SPRITEX>::iterator itSprite=m_lstSpritexList.begin();while(itSprite!=m_lstSpritexList.end()){//draw spriteif(itSprite->itFont==NULL){//get the rect for finding a tiles location on the textureRECT recTile=TextureManager.GetTileRect(itSprite->sTextureName,itSprite->sTileName);//width/height of tileint nTileWidth=recTile.right-recTile.left;int nTileHeight=recTile.bottom-recTile.top;//width/height of sprites destination rectangleint nDestWidth=itSprite->recDest.right-itSprite->recDest.left;int nDestHeight=itSprite->recDest.bottom-itSprite->recDest.top;//centre of spriteD3DXVECTOR2 Centre=D3DXVECTOR2(itSprite->recDest.left+((float)nDestWidth/2),itSprite->recDest.top+((float)nDestHeight/2));//position of spriteD3DXVECTOR2 Trans=D3DXVECTOR2(itSprite->recDest.left,itSprite->recDest.top);//factor to scale sprite byD3DXVECTOR2 Scale=D3DXVECTOR2((float)nDestWidth/nTileWidth,(float)nDestHeight/nTileHeight);//sprite rotation in radians (counter clockwise)float Rotation=(float)itSprite->fRotation*g_fDegreesToRadians;//make the sprite rotate, scale, and be in a specified positionD3DXMATRIX Mat;D3DXMatrixTransformation2D(&Mat,NULL,0.0,&Scale,&Centre,Rotation,&Trans);g_pSprite->SetTransform(&Mat);//draw spriteHRESULT hrDrawSprite=g_pSprite->Draw(TextureManager.GetTexture(itSprite->sTextureName),&recTile,NULL,NULL,itSprite->dwColor//0xFFFFFFFF keeps texture color);//necesary to allow font->drawtext() to work properly with sprite->draw()D3DXMatrixIdentity(&Mat);g_pSprite->SetTransform(&Mat);}//draw textelse{if(itSprite->bWraptext==true)//wrap text{//align left (1)if(itSprite->nAlignment==1)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_LEFT|DT_WORDBREAK,itSprite->dwColor);//align center (2)else if(itSprite->nAlignment==2)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_CENTER|DT_WORDBREAK,itSprite->dwColor);//align right (3)else if(itSprite->nAlignment==3)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_RIGHT|DT_WORDBREAK,itSprite->dwColor);}else//don't wrap text{//align left (1)if(itSprite->nAlignment==1)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_LEFT|DT_NOCLIP,itSprite->dwColor);//align center (2)else if(itSprite->nAlignment==2)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_CENTER|DT_NOCLIP,itSprite->dwColor);//align right (3)else if(itSprite->nAlignment==3)(*itSprite->itFont)->m_Font->DrawText(g_pSprite,itSprite->sText.c_str(),-1,&itSprite->recDest,DT_RIGHT|DT_NOCLIP,itSprite->dwColor);}}++itSprite;//next spritex}g_pSprite->End();//the two lines below helped solve my errorg_pD3DDevice9->SetFVF(g_dwFVF);//g_dwFVF=D3DFVF_XYZRHW|D3DFVF_TEX1g_pD3DDevice9->SetStreamSource(0,g_pVertexBuffer,0,sizeof(VERTEX));