Reputation: 425
I am using Bullet Physics in my own DirectX 11 Game Engine and i want to use the debug draw class provided by bullet. Basicly you are creating a class, that receives all the lines that should be drawn by bullet. Is there an easy and fast way to just draw a 3D Line in DirectX 11 (preferably without using buffers and shaders and all that stuff)?
Upvotes: 1
Views: 2213
Reputation: 1
Any chance of using a triangle in lit wire-frame and making 2 of the verts the same location: x1y1z1,x2y2z2,x2y2z2 I do this in DBPro and it works.
Upvotes: 0
Reputation: 23266
Use LP3DXLINE
and call D3DXCreateLine
to draw a simple line. Calling Draw
with an array of length 2 (start, end) for your line and it should work.
EDIT: This is apparently only DX9. Leaving answer here just in case it helps someone else.
Upvotes: 1
Reputation: 32627
Unfortunately, there is no easy way. You need to create a vertex buffer with the line points. If you want to draw multiple lines, put all your vertices in one buffer to optimize for performance.
Because the FFP has been removed in DirectX 10, you need a simple shader. The vertex shader probably just transforms the vertices with view and projection transform and the pixel shader returns a constant color (depending on your needs).
You would then draw the vertex buffer with an appropriate topology (line list).
The reason why there are no easy methods (like Jesus Ramos' answer or OpenGL's glBegin(GL_LINES)
) is that they cannot be implemented efficiently. It is always necessary to transfer more data to the GPU than needed. That's why it's up to the programmer to write efficient code using buffers.
Upvotes: 4