Srpites ?
-
Hi!
Ich versuche schon seit ein paar Tagen sprites anzeigen zu lassen.
Jedoch geht das immer in die Hose. Gibt es ein Beispiel ? Also KEINE Partikelsysteme oder der gleichen. Ich will erstmal ein Sprite auf der Poition 0.0.0 Rendern.. Gibt es sowas ?Problem: ich seh nichts!
Coder der nicht geht:
IDirect3DVertexBuffer9 *pPSVB; IDirect3DTexture9 *pTexture; struct POINTVERTEX { D3DVECTOR v; D3DCOLOR color; }; #define D3DFVF_POINTVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE) POINTVERTEX vPVertices[1]; void InitPS() { vPVertices[0].v.x = 0.0f; vPVertices[0].v.y = 0.0f; vPVertices[0].v.z = 0.0f; vPVertices[0].color = D3DCOLOR_XRGB(255, 0, 0 ); // Create the vertex buffer. if( FAILED( pGraphics->GetDevice()->CreateVertexBuffer( 1*sizeof(POINTVERTEX), D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS, D3DFVF_POINTVERTEX, D3DPOOL_DEFAULT, &pPSVB, NULL ) ) ) { } // Fill the vertex buffer. VOID* pVertices; if( FAILED( pPSVB->Lock( 0, sizeof(vPVertices), (void**)&pVertices, 0 ) ) ) { } memcpy( pVertices, vPVertices, sizeof(vPVertices) ); pPSVB->Unlock(); D3DXCreateTextureFromFile( pGraphics->GetDevice(), "point.jpg" , &pTexture); } void ReleasePS() { pPSVB->Release(); pTexture->Release(); } inline DWORD FtoDW( float f ) { return *((DWORD*)&f); }; void RenderPS() { pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSPRITEENABLE, true ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSCALEENABLE, true ); // set states //pGraphics->GetDevice()->SetTexture( 0, pTexture); pGraphics->GetDevice()->SetRenderState( D3DRS_LIGHTING, false ); pGraphics->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, false ); pGraphics->GetDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE, true ); pGraphics->GetDevice()->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_INVSRCCOLOR); pGraphics->GetDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(0.00f) ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSCALE_A, FtoDW(0.00f) ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSCALE_B, FtoDW(0.00f) ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSCALE_C, FtoDW(1.00f) ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSIZE, FtoDW(1.0f) ); pGraphics->GetDevice()->SetStreamSource( 0, pPSVB, 0, sizeof( POINTVERTEX) ); pGraphics->GetDevice()->SetFVF( D3DFVF_POINTVERTEX ); /*pPSVB->Lock(0 ,1 * sizeof (POINTVERTEX),(BYTE **) &vPVertices,0); pPSVB->Unlock();*/ //pGraphics->GetDevice()->SetTransform(D3DTS_WORLD, &m_matWelt); pGraphics->GetDevice()->DrawPrimitive( D3DPT_POINTLIST, 0, 1 ); // deset states pGraphics->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, true ); pGraphics->GetDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE, false ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSPRITEENABLE, false ); pGraphics->GetDevice()->SetRenderState( D3DRS_POINTSCALEENABLE, false ); pGraphics->GetDevice()->SetRenderState( D3DRS_LIGHTING, false ); }
Grüsse
-
Hi!
Sry, Admin! Sollte in die Grafik.programmierung !!
Kann das jemand bitte dorthin stellen ?