Hello,

I am creating a windows application to draw 3d cubes. I am preferring to give all the details of the cube in the code itself i.e. dimensions, colour etc.. Suppose there will be two cubes, say with different dimensions and we provide the details with the manner that is mentioned above. This cube will appear whenever I click on the specified button.

I have gone through OPENGL framework to draw this. I could have used that if it would be free to use. However, I searched through web, but unfortunately there are very few information available regarding drawing cube in C#.net.

Any one please provide me a link or some idea about how to draw the cube.


Thanks,
Rajesh

openGL is freee to use, there is no runtime or development costs that Im aware of. You could also look at XNA which while aimed at gaiming is also a framework for drawing like that.

However, drawing a 3d cube in c# in general would be the same as asking how to draw it on paper, its the same for any language, you need the maths to work out the angles, lengths etc.

You can also use DirectX SDK

3D is a world of it's own.
I suggest first reading "3D programming for windows" from Charles Petzold.
Learn about the math needed(quaternions ! fun!)
Learn about projections, light, shade, viewports, rotation etc.
Mostly with XAML code but also C# code.
Very good book.

Yha ,, 3D programming for windows " is kinda good

Draw the cube on a piece of paper. Determine x,y,z for each vertex and write them all down. Then using open GL create your viewing volume and using triangles or another primitive shape map your points in clock-wise direction. This will require some knowledge about OpenGL. You can do all of this with XNA in about 10 lines of code.

You can also use DirectX SDK

can you help me i need to draw a cube and sphere with directx

You can also use DirectX SDK

i'm using C# 2008 with directx9

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.