A few questions

This is a discussion on A few questions within the Game Programming forums, part of the General Programming Boards category; 1 ) How can i draw a single line in D3D? 2 ) How can i draw 2D/3D font ?...

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    A few questions

    1 ) How can i draw a single line in D3D?
    2 ) How can i draw 2D/3D font ?

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    1. Use ID3DXLine or DrawPrimitive(D3DPT_LINELIST,.....)
    2. Use ID3DXFont or Windows GUI.

    The D3DX library has functions for both 2D and 3D text.

  3. #3
    Banned
    Join Date
    Oct 2004
    Posts
    250
    do you know of a tutorial for drawing text in D3D?

  4. #4
    Banned
    Join Date
    Oct 2004
    Posts
    250
    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);

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    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

    Code:
    pDevice->SetFVF( D3DFVF_XYZ|D3DFVF_DIFFUSE);
    Or whatever your necessary flags are.
    "...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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 09:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 06:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 08:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 08:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21