Archived

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

polygon doesnt show up

This topic is 5380 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 defined simple polygon: D3DVERTEX cvVertices[] = { {1.0f ,0.0f , 1.0f, D3DCOLOR_XRGB(0, 255, 255)}, {1.0f ,0.0f , 2.0f, D3DCOLOR_XRGB(255, 0, 0)}, {2.0f ,0.0f , 2.0f, D3DCOLOR_XRGB(0, 255, 255)}, }; m_pD3DDevice->SetStreamSource(0,m_pVertexBuffer,sizeof(TERRAIN_D3DFVF_CUSTOMVERTEX)); m_pD3DDevice->SetVertexShader(TERRAIN_D3DFVF_CUSTOMVERTEX); m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST ,0,1); and look at it with following camera: D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(1.5f, 1.5f , -5.0f), //position of cam &D3DXVECTOR3(1.5f, 0.0f , 1.5f), //look at &D3DXVECTOR3(0.0f, 1.0f , 0.0f)); I don''t get to see the polygon which is strange because I look at the position of the polygon (culling is turned off...) When I rotate the world I sometimes get to see a polygon (which consist out of 1 color and not an interpolation of the 3 vertexcolors I have defined???) perspective setting of the cam: D3DXMATRIX matProj; D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4, 1.0f, 1.0f, 500.0f); m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); } someone has some advice? regards STijn

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
how baout u post your real code, not wrong ordered clips

Share this post


Link to post
Share on other sites
What is the code for switching the culling off ? I had this problem when I culled wrong side of polygons.

You better post your whole code, defin.of FVF and such so we can see it and find the real mistake.

Share this post


Link to post
Share on other sites
I presume you have turned lighting off ?

m_pD3DDevice->SetRenderState(D3DRS_LIGHTING,FALSE);

and your Vertex struct is something like :

struct VERTEX
{
float x,y,z;
DWORD DiffuseColor;
};

and FVF is :

(D3DFVF_XYZ|D3DFVF_DIFFUSE), I''m presuming this as you have untransformed vertices.

Regards,
Steve

Share this post


Link to post
Share on other sites
Culling code (and other)

m_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
m_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

#define TERRAIN_D3DFVF_CUSTOMVERTEX(D3DFVF_XYZ | D3DFVF_DIFFUSE )
struct D3DVERTEX
{
float x, y, z;
DWORD color;
};

Please reply if u need more code :-)

regards
STijn

Share this post


Link to post
Share on other sites