Jump to content
  • Advertisement
Sign in to follow this  
_spak

[DX] Textured quad

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

Hello, When i render textured quad i get someting like this: It looks like quad(color set to wite) is showing up through texture. vertex format i'm using: D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_TEX1

Share this post


Link to post
Share on other sites
Advertisement
texture:

code:

type
TVertex = record
x, y, z, rhw: single;
color: DWORD;
tu, tv: single;
end;

const
vertices: array[0..3] of TVertex =(
(x: -4.5; y: 359.5; z:0.0; rhw:1.0; color:$ffffffff; tu: 0; tv: 0),
(x: 104.5; y: 359.5; z:0.0; rhw:1.0; color:$ffffffff; tu: 1; tv: 0),
(x: -4.5; y: 459.5; z:0.0; rhw:1.0; color:$ffffffff; tu: 0; tv: 1),
(x: 104.5; y: 459.5; z:0.0; rhw:1.0; color:$ffffffff; tu: 1; tv: 1));

g_pd3dDevice.SetFVF(D3DFVF_XYZRHW or D3DFVF_DIFFUSE or D3DFVF_TEX1);
g_pd3dDevice.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(TLVertex));

and i'm seting these before drawing:
g_pd3dDevice.SetRenderState( D3DRS_ALPHABLENDENABLE, iTRUE );
g_pd3dDevice.SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
g_pd3dDevice.SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );

g_pd3dDevice.SetRenderState(D3DRS_ZENABLE, iFALSE);
g_pd3dDevice.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

g_pd3dDevice.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
g_pd3dDevice.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
g_pd3dDevice.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);


Share this post


Link to post
Share on other sites
Well, it should be easy to prove or disprove your initial hypothesis by setting the quad to a different colour (bright red, ffff0000 might be a good choice), and then rendering it again.

This shouldn't be the case with your vertex format - the colour should alter all of the texture. Any 'holes' in the texture ought to show the background colour (you're clearing the backbuffer, right?).

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!