Jump to content
  • Advertisement

Archived

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

Frankski

Problem rendering clean texture (for 2D menus)

This topic is 5675 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 have a problem. I want to have menus and splash screen in my game, so I need some sort of 2D rendering of a 800*600 texture on screen. My engine is using DX9. The problem is when I set and render the panel in 2D, the texture is distorted or blurred (ie it''s not clean as in photoshop) My screen is 800*600 and my texture is 800*600 and I''m rendering it at 0,0 so its not a scaling problem. Its like trying to anti-aliasing the colors so the result is distorted (ie dots/pixelize) Here is me render code followed by my FVF structure, I was thinking maybe its the fvf? I was told that I should add a rhw variable to my structure but I''m not sure I understand that part. m_pD3DDevice->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(PANEL_CUSTOMVERTEX)); m_pD3DDevice->SetFVF(PANEL_D3DFVF_CUSTOMVERTEX); ... m_pD3DDevice->SetTexture(0, m_pTexture); m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); #define PANEL_D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) struct PANEL_CUSTOMVERTEX { FLOAT x, y, z; //Position of vertex DWORD colour; //Colour of vertex FLOAT u, v; //Texture coordinates }; If anyone know an answer or can point me in the good direction, that''d be great! thx Frankski

Share this post


Link to post
Share on other sites
Advertisement
I know on most modern cards this shouldn''t be the case, but is the texture actually 800*600? A lot of cards prefer only textures that are to the power of two, so test it with a 256x256 texture and see if you get a clean image.
If this is the cause then you''ll want to split up the texture.

Share this post


Link to post
Share on other sites
Well, the rhw is to create transformed vertices, so you can set the final position in it.

The problem could be your texture stage state, try something like this


  
m_pDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR);
m_pDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR);
m_pDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_POINT);



By the way, not all the cards support a 800x600 texture, the card can be scaling it to 512x512

If God with me, Who against me?

Share this post


Link to post
Share on other sites
Thanks both of you! My card is a voodoo 3, a shity card and I just went in dx_caps, its says max textures size is 256*256 so you guys are right, thank you.

I tested with > 256*256 its not good, and I tested it with irregular size under 256 (ie 256*200, 200*100...) and its fine, so the problem is really the maximum size.

Damn voodoo card. I will have to break my big texture into smaller parts but at least it will look good.

Frankski

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!