Line object 
Author Message
 Line object

Does anyone have any sample code that illustrates how to use the Line object
with Direct3D?   No matter what I try, I cannot get a line to display.

Any assistance is appreciated!

Thanks



Thu, 23 Jun 2005 01:59:13 GMT  
 Line object
Sorry, should have mentioned I'm using DirectX 9.


Quote:
> Does anyone have any sample code that illustrates how to use the Line
object
> with Direct3D?   No matter what I try, I cannot get a line to display.

> Any assistance is appreciated!

> Thanks



Fri, 24 Jun 2005 06:19:22 GMT  
 Line object

Seems pretty straightforward. Just create an instance and create at least
two Vector2 objects.

The following is in C#. Put it in your Render loop, somewhere between the
device.BeginScene() and device.EndScene(). Note that it appears that all
vertices are in screen coordinates with 0,0 being the upper-left.

The following will draw a triangle in the upper left corner (4 verts total):
// Obvisouly, don't create line in the Render loop
// Declare it at the top of the form
// Set it to new... in the InitializeDeviceObjects function or
// wherever you create your device.
// This also assumes you've got the following at the top
// to alias the name "Direct3D":
//        using Direct3D=Microsoft.DirectX.Direct3D;
Direct3D.Line line = new Direct3D.Line(device);
// Create a new array of Vector2 objects.
// Fill them inline by creating 4 new Vector2 objects
line.Draw(new Vector2[] {new Vector2(0, 0), new Vector2(100, 100), new
Vector2(0, 100), new Vector2(0, 0)}, Color.Yellow);

-Nerseus


Quote:
> Sorry, should have mentioned I'm using DirectX 9.



> > Does anyone have any sample code that illustrates how to use the Line
> object
> > with Direct3D?   No matter what I try, I cannot get a line to display.

> > Any assistance is appreciated!

> > Thanks



Sun, 26 Jun 2005 05:21:31 GMT  
 Line object

Thanks for the help!   I can now get the .Draw method on the line to work,
but that only draws lines in screenspace, as you said.   The .DrawTransform
method takes an array of Vector3 and a transformation matrix.  This still
doesn't seem to work.

Thanks again,

Mike


Quote:

> Seems pretty straightforward. Just create an instance and create at least
> two Vector2 objects.

> The following is in C#. Put it in your Render loop, somewhere between the
> device.BeginScene() and device.EndScene(). Note that it appears that all
> vertices are in screen coordinates with 0,0 being the upper-left.

> The following will draw a triangle in the upper left corner (4 verts
total):
> // Obvisouly, don't create line in the Render loop
> // Declare it at the top of the form
> // Set it to new... in the InitializeDeviceObjects function or
> // wherever you create your device.
> // This also assumes you've got the following at the top
> // to alias the name "Direct3D":
> //        using Direct3D=Microsoft.DirectX.Direct3D;
> Direct3D.Line line = new Direct3D.Line(device);
> // Create a new array of Vector2 objects.
> // Fill them inline by creating 4 new Vector2 objects
> line.Draw(new Vector2[] {new Vector2(0, 0), new Vector2(100, 100), new
> Vector2(0, 100), new Vector2(0, 0)}, Color.Yellow);

> -Nerseus



> > Sorry, should have mentioned I'm using DirectX 9.



> > > Does anyone have any sample code that illustrates how to use the Line
> > object
> > > with Direct3D?   No matter what I try, I cannot get a line to display.

> > > Any assistance is appreciated!

> > > Thanks



Mon, 27 Jun 2005 04:34:37 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. put line object on differnet object !?!

2. shape and line objects

3. Creating a line object

4. line object

5. Q: dynamic generation of line objects

6. Creating a line object in VB

7. Alternative to shape and line objects

8. creating a subclass line object

9. How to hide Line Object in Crystal Report

10. Coloring a Line Object in Formula

11. Creating multiple line objects

12. Line Object.

 

 
Powered by phpBB® Forum Software