Question about DirectX11 and braynzarsoft tutorial 18 FPS Camera

Started by
1 comment, last by Conny14156 11 years, 3 months ago

Hi,

Am trying to render a simple plane that work like the ground.

And this is the tutorial am following. in this tutorial he is



//Plane Vertex Vertex(-1.0f, -1.0f, -1.0f, 100.0f, 100.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, -1.0f, 0.0f, 100.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f), Vertex(-1.0f, -1.0f, 1.0f, 100.0f, 0.0f, 0.0f, 1.0f, 0.0f),




 DWORD indices[] = 
{
 0, 1, 2,
 0, 2, 3, 
}; 

void UpdateScene(double time)

{

groundWorld = XMMatrixIdentity(); //Define cube1's world space matrix

Scale = XMMatrixScaling( 500.0f, 10.0f, 500.0f );

Translation = XMMatrixTranslation( 0.0f, 10.0f, 0.0f );

groundWorld = Scale * Translation;

}


XMMATRIX groundWorld; 

XMMATRIX Translation;

XMMATRIX Scale ;


The problem with this plane, is that when I try to render it I see nothing.

The problem I could come up with was that the plane was facing down and not up.

So I tried to rotate the plane and I succeded to see it, but I was wondering why in hes example he got the plane facing upward but while mine is facing downward.

P.S

I also got direction light and on mine after I rotate the plane the light bounce as normal. but how come my plane start facing downward and not upward?

I posted what I think is the most essensial. but please do tell me if I miss something

http://www.braynzarsoft.net/index.php?p=D3D11FPC

Advertisement

You can make yours face upwards by simply reversing the rendering of the vertices, instead of:


//Plane Vertex Vertex(-1.0f, -1.0f, -1.0f, 100.0f, 100.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, -1.0f, 0.0f, 100.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f), Vertex(-1.0f, -1.0f, 1.0f, 100.0f, 0.0f, 0.0f, 1.0f, 0.0f),

do this:


//Plane Vertex Vertex(-1.0f, -1.0f, 1.0f, 100.0f, 0.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f), Vertex( 1.0f, -1.0f, -1.0f, 0.0f, 100.0f, 0.0f, 1.0f, 0.0f), Vertex(-1.0f, -1.0f, -1.0f, 100.0f, 100.0f, 0.0f, 1.0f, 0.0f),

Thanks,am closer to what I want now :3

This topic is closed to new replies.

Advertisement