I'm new to Directx and i want to render Cylinder using "D3DXCreateCylinder" function. I using Delphi Xe2 and JEDI for DirectX9.
closed as not a real question by bummzack, Sean Middleditch, Josh Petrie♦, Byte56♦, John McDonald Apr 5 '13 at 17:41
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.
First declare direct3D Object, RenderingDevice and Mesh as global variable. In order to use DirectX in the Delphi - Pascal, add Direct3D9, D3DX9, DXTypes in USES clause.
Create Function for Initialization of Direct3D:
I will render 3D on TPanel component of the Delphi. So i passing Handle of TPanel Component as parameter. Another Function to setup a Matrix:
And Last procedure for Rendering:
Uses a left-handed coordinate system to create a mesh containing a cylinder.
pDevice [in] Pointer to an IDirect3DDevice9 interface, representing the device associated with the created cylinder mesh.
Radius1 [in] Radius at the negative Z end. Value should be greater than or equal to 0.0f.
Radius2 [in] Radius at the positive Z end. Value should be greater than or equal to 0.0f.
Length [in] Length of the cylinder along the z-axis.
Slices [in] Number of slices about the main axis.
Stacks [in] Number of stacks along the main axis.
ppMesh [out] Address of a pointer to the output shape, an ID3DXMesh interface.
ppAdjacency [out] Address of a pointer to an ID3DXBuffer interface. When the method returns, this parameter is filled with an array of three DWORDs per face that specify the three neighbors for each face in the mesh. NULL can be specified.
Return Value: If the function succeeds, the return value is D3D_OK.
After Creating All the Function and Procedure first call InitD3D(hWindow) and then call Render().