-
Aug 18th, 2010, 07:31 AM
#1
Thread Starter
Lively Member
draw 3D cube Direct3D
Hi all,
I have a question. Does somebody knows a good tutorial to draw 3D with Direct3D and VB.NET.
I'm trying to draw a cube on the screen with Direct3D, and afterwards I want to draw cylinders and other 3D polygons.
Can somebody help me?
Thanks in advance.
Geemuse
-
Aug 18th, 2010, 08:07 AM
#2
Re: draw 3D cube Direct3D
I got one for a cube. It uses Managed Direct3D and isn't the prettiest in the world since the triangles that make up each vertexed side are hard coded, but the end result is nice. You can spin the thing in 3D space with the mouse. It's my only example of "drawing" a 3D object in DirectX, rather than just loading in a mesh.
I tried to do a sphere generator as well but it suffered from vertex inversion that I couldn't quite figure out (half the triangles were drawn the wrong way and thus, appeared as holes in the sphere)
If this is what you're looking for, I can pack it up and post it.
-
Aug 18th, 2010, 08:13 AM
#3
Thread Starter
Lively Member
Re: draw 3D cube Direct3D
What is the best way to do...create a mesh and draw every object in it and then put it on the screen, or just put everything right a way on the screen.
Yeah please, so I can look at it and see how it really works. I want to convert it into a dynamically created cube...with the points stored in databases.
Thanks
Geemuse
-
Aug 20th, 2010, 03:14 PM
#4
Re: draw 3D cube Direct3D
Sorry it took a little while for me to post this. Things got frantic suddenly.
You need the Managed DirectX SDK installed to compile this. You can get these files here direct from Microsoft.
Attached is the project; I included the compiled binary if you just want to check it out. A picture of the program running is posted below. Click and drag the cube to spin and rotate it.
RenderTest.zip
-
Mar 12th, 2011, 03:31 AM
#5
Re: draw 3D cube Direct3D
Originally Posted by Jenner
Sorry it took a little while for me to post this. Things got frantic suddenly.
You need the Managed DirectX SDK installed to compile this. You can get these files here direct from Microsoft.
Attached is the project; I included the compiled binary if you just want to check it out. A picture of the program running is posted below. Click and drag the cube to spin and rotate it.
RenderTest.zip
interesting directX. how would i show an image on each side so i could make the cube a dice?
+ more complicated i know, how could i convert this cube into a rubiks cube?
any advice would be appreciated
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 12th, 2011, 06:08 PM
#6
Re: draw 3D cube Direct3D
In this example, I'm just drawing the triangles of the cube object manually rather than load in a mesh, but since it's only a cube, it's easily done. Now, drawing on the faces would be done by applying textures to them. You would make a set of textures each representing the face of a dice and tell the engine to apply them to the appropriate face. I have an example of this somewhere using a meshed object. Let me see if I can adapt it to this generated object.
A Rubik's cube would be easiest done by generating multiple cube objects. Make 26 individual cubes, and stack them into a 3x3x3 arrangement (you can skip the center-most cube). This way, you can create rotation methods for rotating the various slices.
Last edited by Jenner; Mar 12th, 2011 at 06:28 PM.
-
Aug 3rd, 2012, 11:54 PM
#7
New Member
Re: draw 3D cube Direct3D
Well I made one in WPF which supports meshes and all kinds of things
-
Aug 6th, 2012, 12:32 PM
#8
Re: draw 3D cube Direct3D
Easy enough and nothing new since WPF natively uses Direct3D and has plenty of support for simple 3D operations. This example is more about setting up your own Direct3D environment using WinForms as a base and drawing to it. You realize this thread is over a year and a half old too?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|