Archived

This topic is now archived and is closed to further replies.

Pointsprites question

This topic is 5795 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a quick question about d3d pointsprites - i was trying to write something along the lines of the point sprites demo that ships with the D3D SDK; I am rendering a reflected view of the particles, rendering an alpha-blended ground plane, then the particles again on top - now, when I render the ground on it''s own, i get round about 677fps, and the same when I render the particles on their own, but render the two together, and the frame rate drops to about 20-25 fps, which is a goddamn massive drop. Does anyone have any ideas as to why the frame rate is dropping so far? Here''s the code from the render function, if you want any more let me know... // Clear the viewport m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0, 1.0f, 0L ); D3DXMATRIX mMatReflect, mID; D3DXMatrixIdentity(&mID); // Begin the scene if( SUCCEEDED( m_pd3dDevice->BeginScene() ) ) { // TODO: render world m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE ); m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE ); // Render stats and help text RenderText(); D3DXMatrixReflect(&mMatReflect, &m_pPlaneGround); m_pd3dDevice->SetTransform(D3DTS_WORLD, &mMatReflect); //m_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); if(m_pParticles->RenderParticles()==E_FAIL) return E_FAIL; m_pd3dDevice->SetTransform(D3DTS_WORLD, &mID); m_pd3dDevice->SetIndices(ibGround,0); m_pd3dDevice->SetStreamSource(0,vbGround,sizeof(D3D_GROUNDVERTEX)); m_pd3dDevice->SetVertexShader(D3DFVF_GROUNDVERTEX); m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE,TRUE); m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA ); m_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,dwNumGroundVertices,0,dwNumGroundIndices/3); if(m_pParticles->RenderParticles()==E_FAIL) return E_FAIL; // End the scene. m_pd3dDevice->EndScene(); }

Share this post


Link to post
Share on other sites