ivanik

first iam beginner,iam using sample framework to try create primitive mesh, after i initialize the mesh like this int OnCreateDevice:

_mesh = Mesh.Box(_device,2.0f,2.0f,2.0f);

then i render it on OnFrameRender like this;

device.Transform.World = Matrix.Translation(0,0,0);

Material mtrl = new Material();

mtrl.Diffuse = Color.White;

mtrl.Ambient = Color.Green;

device.Material = mtrl;

_mesh.DrawSubSet(0);

iam finished my code..

but i see nothing..

iam wonder what is the OnFrameMove i have to write code on OnFrameMove to see my mesh Box or i missed something ..

thanks,

ivanik



Re: Game Technologies: DirectX 101 Sample Framework

MoniDD

Possible reasons:

- Lights are off

- Camera is pointing the other way.

I had the same trouble when I was starting.

Have a look at this link that describes my search for a "Working C# Teapot Sample"

http://www.gamedev.net/community/forums/topic.asp topic_id=397700





Re: Game Technologies: DirectX 101 Sample Framework

The ZMan

OnFrameMove is where you would normally move things you do NOT have to have it.

As MoniDD says there are MANY reasons why you see nothing. You shoudl start with the tutorials in the SDK and then follow online tutorials and see why your program is different to them.






Re: Game Technologies: DirectX 101 Sample Framework

MoniDD

About the sample I pointed you to.

It will ONLY get you started - namely - you will get to a point where you will see a cleaned out code that will help you see an object on the screen.

Cleaned out - means - a proof of concept, not convoluted and easy to read, however with many best practices violations.

Up to you to decide how to improve it - "be as bad as you want to be"

The SDK tutorials are cool but depending on where you stand they might be too convoluted to read.

Get ZMan's tutorials and inhale them - will only do you good ...

Also - at the beginning create separate small projects for each new feature you want to learn. I personally advise that at the very early stage you disregard coding-best practices completely to keep the samples bone-dry and focussed on DirecX ONLY.

Then you phase in coding best-practices when you start larger projects.





Re: Game Technologies: DirectX 101 Sample Framework

ivanik

thanks ..

i have finished this problem, i just add this code on OnResetDevice:

e.Device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4,aspectRatio, 0.1f, 100.0f);

e.Device.Transform.View = Matrix.LookAtLH(new Vector3(0, 0, -5.0f), Vector3.Empty,new Vector3(0, 1, 0));

yesterday i dont add this code because i see on OnresetDevice code like this:

// Setup the camera's projection parameters

float aspectRatio = (float)bbufferDesc.Width / (float)bbufferDesc.Height;

camera.SetProjectionParameters((float)Math.PI / 4, aspectRatio, 0.1f, 1000.0f);

camera.SetWindow(bbufferDesc.Width, bbufferDesc.Height);

so what the purpose of this code,,

thanks,

ivanik