Jump to content
  • Advertisement
Sign in to follow this  
NEd2k

point sprites not visible

This topic is 4392 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!