Jump to content
  • Advertisement
Sign in to follow this  
Eddie Zehoo

Vertex Declaration and SetFVF

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

Hi, I'm having problems with FVF. It seems that if I have RHW enabled, the following works, and there's no problem : lp_3DDevice->SetVertexShader(NULL); lp_3DDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1); But once I turn RHW off, I get this message in VisualC++'s debug window : "Direct3D9: (ERROR) :Current vertex shader declaration doesn't match VB's FVF" I am very sure my Vertex structs and flags have all been defined appropriately.Any idea, anyone? Thx! Regards, Ed Zehoo

Share this post


Link to post
Share on other sites
Advertisement
To solve this we would really need to see your vertex structure declaration that you are using to fill your vertex buffer that you are trying to render in that call.

Share this post


Link to post
Share on other sites
Hi Daedalus,
Thanks for posting! .. but I fixed it already. It was due to SetFVF not being in the Render loop.. I called it only once during Initialization. Geez, MSDN never said anything about SetFVF having to be in the Render loop.... another day wasted.

but thanks anyway!
Regards,
Ed Zehoo

Share this post


Link to post
Share on other sites
SetFVF does not have to be in the render loop. You can set it at the beginning of the application and never set it again. But you have to make sure you're not setting anything else that can clobber you FVF declaration. if you are using SetVertesxShader after that, then that effectively invalidates your SetFVF call. Or if you lose the device your FVF call is invalidated as well.

Share this post


Link to post
Share on other sites
Hi IFoobar,
I've checked through my Render function again, but I can't see anything which would clobber the SetFVF call. Here's my Render function below :
(Could it be the D3DXFont object - lp_FontObj) ?

Thx!

void ML_GAMEAPP::Render()
{
lp_Direct3DDevice->BeginScene ();
//Print out the FPS Text
if (lp_FontObj!=NULL) lp_FontObj->Begin();
if (lp_FontObj!=NULL) lp_FontObj->DrawTextA((LPCSTR)strTextBuffer,-1,&rctFontRect,DT_LEFT,0xFFBBBBBB);
if (lp_FontObj!=NULL) lp_FontObj->End();
//Draw the quad
lp_3DDevice->SetTexture (0,lp_TextureToLoad);
lp_3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST,0,2);
lp_Direct3DDevice->EndScene ();
lp_Direct3DDevice->Present(NULL,NULL,NULL,NULL);
UpdateFPS();
}


void ML_GAMEAPP::UpdateFPS()
{
lngFramesElapsed++;
float fltCurrentUpdate = GetGameTime();
if( fltCurrentUpdate - fltLastUpdate > fltUpdateInterval )
{
fltFPS = lngFramesElapsed / (fltCurrentUpdate - fltLastUpdate);
fltLastUpdate = fltCurrentUpdate;
lngFramesElapsed = 0;
}
sprintf(strTextBuffer,"FPS : %.2f",fltFPS);
}

Share this post


Link to post
Share on other sites
Might be the font, try doing the font stuff after you render and if it works then it was definetly the font. Though the font uses state blocks if im not mistaken and restores the previous state block on the End() call. But I dunno, give it a try...

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!