Jump to content
  • Advertisement
Sign in to follow this  
maya18222

lineadj

This topic is 3085 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 cant seem to get this to work, nothing is displayed. Am I doing it right? Im just playing, and what to render out a linestream, like this. adjleft ------------ v0 --------------v1 ---------------adjright
Vertex v[4];
v[0] = Vertex(  1.0f, 0.0f, 0.0f);   // adjleft
v[1] = Vertex(  2.0f, 0.0f, 0.0f);   // V0
v[2] = Vertex(  3.0f, 0.0f, 0.0f);   // V1
v[3] = Vertex(  4.0f, 0.0f, 0.0f);   // adjright

DWORD i[4]; // indices
i[0] = 0; // adjleft
i[1] = 1; // V0
i[2] = 2; // V1
i[3] = 3; // adjright

UINT stride = sizeof(Vertex);
UINT offset = 0;
md3dDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ);
md3dDevice->IASetVertexBuffers(0, 1, &mVB, &stride, &offset);
md3dDevice->IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0);
md3dDevice->DrawIndexed(2, 0, 0);


and then my shader looks like this
[maxvertexcount(4)]
void GS_Bezier1( lineadj VS_OUT gIn[4], inout LineStream<GS_OUT> lineStream)
{
	GS_OUT gOut;
	
	gOut.posH = mul(float4(gIn[0].posL,1.0f), gWVP);
	lineStream.Append(gOut);

        gOut.posH = mul(float4(gIn[1].posL,1.0f), gWVP);
	lineStream.Append(gOut);

        gOut.posH = mul(float4(gIn[2].posL,1.0f), gWVP);
	lineStream.Append(gOut);

        gOut.posH = mul(float4(gIn[3].posL,1.0f), gWVP);
	lineStream.Append(gOut);

	lineStream.RestartStrip();
}


From what I understand, using lineadj, the vertex shader will get v0 and v1, and the geometry shader adjleft,v0,v1 and adjright. it seems to work when i pass 4 indices, like this md3dDevice->DrawIndexed(4, 0, 0); But doesnt that mean that Im passing 4 vertices to the Vertex shader too? when I should only really be passing 2 to the vertex shader?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by maya18222
But doesnt that mean that Im passing 4 vertices to the Vertex shader too? when I should only really be passing 2 to the vertex shader?

All of the vertices are actually processed by the vertex shader. Even those that do not correspond to the drawn primitive. The pipeline expects 4 indices from you.

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.

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!