Jump to content
  • Advertisement

Archived

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

DarkZoulz

XYZRHW and XYZ?

This topic is 5221 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 want to render a scene with some 3D meshes and then a GUI on top of that. First I set a perspective projection and then render my meshes. After that I set a ortho projection and try to render my textured RHW polygons. Set 3D perspective and FVF Render meshes Set 2D perspective and FVF Render polygons My problem is that my GUI don''t even show up. But if I don''t render the meshes, it does. Is it not possible to have both XYZRHW and XYZ polygons in one scene?

Share this post


Link to post
Share on other sites
Advertisement
You don''t need to set an ortho projection if you''re using RHW. RHW skips world, view, projection, lighting, viewport scaling, etc.

Since your 2D objects appear when you aren''t drawing your 3D, it sounds like you have valid data, which narrows it down to exactly one thing... lucky that.

What Z value are you putting into your 2D mesh/sprites? It must be between 0 and 1, and must be low enough that it''s in front of your 3D meshes. Alternatively you can disable Z (D3DRS_ZENABLE,false) when rendering your 2D overlay.

Share this post


Link to post
Share on other sites
I set the Z value to 1. But I disable Z when rendering 2D stuff. Should I SetFVF() for each mesh and 2D polygon I render?

This is my code that renders a mesh:

IDirect3DDevice9 *dev = C_Frost_Engine::Get_Instance()->Get_Device();
dev->SetFVF(pMesh->GetFVF());

for(int i = 0; i < mMatCount; i++)
{
dev->SetMaterial(&pMaterial[i]);
pTexture[i].Set_Texture();
pMesh->DrawSubset(i);
}


And this renders my 2D polygon:

IDirect3DDevice9 *dev = C_Frost_Engine::Get_Instance()->Get_Device();

dev->SetFVF(D3DFVF_2D_VERTEX);
pTexture->Set_Texture();
dev->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);

Share this post


Link to post
Share on other sites
You only need to set the FVF when it changes (ie: twice a frame for you).

Are you sure Z is disabled? I can''t think of any other reason for it to not work. Try setting the Z to 0, or 0.0001 in your sprites/2D meshes.

Share this post


Link to post
Share on other sites
Ah, it seems that I needed to SetStreamSource() when rendering my 2D objects. I only set it once in the 2D objects constructor before. It works now! Thanks for your help!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!