1 ) How can i draw a single line in D3D?
2 ) How can i draw 2D/3D font ?
1 ) How can i draw a single line in D3D?
2 ) How can i draw 2D/3D font ?
1. Use ID3DXLine or DrawPrimitive(D3DPT_LINELIST,.....)
2. Use ID3DXFont or Windows GUI.
The D3DX library has functions for both 2D and 3D text.
do you know of a tutorial for drawing text in D3D?
i still cant draw a line either
Code:tVertex vertexarray[2] ={ {-1.0f,10.0f, 0.0f,D3DCOLOR_RGBA(200,100,100,100) }, {1.0f, 0.0f, 0.0f}, };Code:D3DXMatrixTranslation(&matWorld,-1.5,0.0f,6.0f); pD3DDevice->SetTransform(D3DTS_WORLD,&matWorld ); / pD3DDevice->DrawPrimitive(D3DPT_LINELIST,0,1);
For the font rendering using D3DX, go here
http://www.drunkenhyena.com/cgi-bin/directx.pl
As for the line. When you use DrawPrimitive Direct3D expects you to have a vertex buffer created and set. I imagine you just wanted to try this out real quick with your array so you should use DrawPrimitiveUP (User-Pointer). This takes as a parameter the array of vertices. Make sure you specify the color for your 2nd vertex in that array, make sure you set your FVF's using
Or whatever your necessary flags are.Code:pDevice->SetFVF( D3DFVF_XYZ|D3DFVF_DIFFUSE);
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers