×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

I am unable to use DirectX.Direct3D for reference as it gets ignored

I am unable to use DirectX.Direct3D for reference as it gets ignored

I am unable to use DirectX.Direct3D for reference as it gets ignored

(OP)
thread761-1598689: newbie problem with DirectX
I have installed Visual Studio 2017 and have tried to use that Triangle example with DirectX 9 in vb.net but unable to use DirectX.Direct3D for a reference. I have no idea on how to proceed. There is an error in code as it says it needs something from Visual C#. I am inserting my code.
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class Form1
Private device As Direct3D.Device
Public Sub Initialize()
Dim present As PresentParameters = New PresentParameters
present.Windowed = True 'we?ll draw on a window
present.SwapEffect = SwapEffect.Discard 'discuss later
device = New Direct3D.Device(0, DeviceType.Hardware, Me, CreateFlags.SoftwareVertexProcessing, present)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True) 'Do not draw form?s background\
Me.Height = 500
Me.Width = 500
Me.Text = "DirectX Tutorial using Visual Basic"
Initialize()
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim vertices As CustomVertex.TransformedColored() = New CustomVertex.TransformedColored(0 To 2) {} 'create an array of vertices
vertices(0).Position = New Vector4(150, 100, 0, 1)
vertices(0).Color = Color.Red.ToArgb 'encode color in Argb
vertices(1).Position = New Vector4(Me.Width / 2 + 100, 100, 0, 1)
vertices(1).Color = Color.Green.ToArgb
vertices(2).Position = New Vector4(250, 300, 0, 1)
vertices(2).Color = Color.Yellow.ToArgb
device.Clear(ClearFlags.Target, Color.Black, 1.0, 0)
device.BeginScene() 'all drawings after this line
device.VertexFormat = CustomVertex.TransformedColored.Format
'error for this line says:
'Describes custom vertex format structure that contains transformed vertices and color information.
'Reference required to assembly Microsoft.visualc,Version 7.0.5000.0 culture=neutral,publickey
'tokens= 'b03f5f711d50a3a' containing the type 'isconstmodifier'
'I realize that it needs Microsoft.DirectX.Direct3D but I am unable to get it to go into references.
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, vertices)
device.EndScene() 'all drawings before this line
device.Present()
Me.Invalidate() 'redraw
End Sub
End Class

RE: I am unable to use DirectX.Direct3D for reference as it gets ignored

(OP)
How do I remove my question? I have been succesful in creating directX 9 in vb.net,C# and C++. All I had to do was use Version 2 and use Visual C as reference.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close