Sign in to follow this  

point sprites not visible

This topic is 4201 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

I am using the "Tutorial 17: Point Sprites" from http://www.riaz.de/tutorials/d3d17/d3d17.html to create a ship engine. The sprite is rendered to my desired position and color, but sometimes when I rotate the camera the sprite is not rendered althow there is no other object in front of it. Has someone have any idea why is this happening ? -- Create Code void* pData; D3DVERTEX point[] = { {-0.5f,0.866f,0.0f,10000.21f,0xff0000ff} }; mDevice->CreateVertexBuffer( sizeof(point), D3DUSAGE_POINTS | D3DUSAGE_WRITEONLY,D3DFVF_CUSTOMVERTEX,D3DPOOL_MANAGED,&mSpriteVB,NULL); mSpriteVB->Lock(0,0,&pData,0); memcpy(pData,point,sizeof(point)); mSpriteVB->Unlock(); if (FAILED(D3DXCreateTextureFromFile (mDevice,"sprite.png",&mSpriteTex))) return; -- Render Code mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); mDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); mDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); mDevice->SetTexture(0,mSpriteTex); mDevice->SetStreamSource(0,mSpriteVB,0,sizeof(D3DVERTEX)); D3DXMatrixTranslation(&matTranslation,50.0f,260.0f,-30.0f); mDevice->SetTransform(D3DTS_WORLD,&(matTranslation * mMatrix)); mDevice->DrawPrimitive(D3DPT_POINTLIST,0,1);

Share this post


Link to post
Share on other sites
It seems that the problem was coaysed because the D3DRS_LIGHTING render state was set to TRUE, when I turned it to FALSE the sprite was rendered correctly while moving the camera.

Share this post


Link to post
Share on other sites

This topic is 4201 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this