|
|||||||
| Forum Home | Register | Members List | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||
|
Junior Member
|
Hi everyone i am creating my first triangle in visual basic with slimdx, but i doesn´t work,PLease anyone could check my code and tell me what is wrong?
here is the link to download the visual basid project if you want to execute it: http://rapidshare.com/files/32387928...limDX.rar.html and if you prefer here is all the code: Imports SlimDX Imports SlimDX.Direct3D9 Public Class Form1 Private device As Device Public d3d9 As New SlimDX.Direct3D9.Direct3D Public Structure CustomDiffuse Public Position As Vector3 Public Color As Int32 End Structure Public Sub initialize() Dim present As PresentParameters = New PresentParameters present.Windowed = True present.SwapEffect = SwapEffect.Discard device = New Device(d3d9, 0, DeviceType.Hardware, Me.Handle, CreateFlags.SoftwareVertexProcessing, present) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Text = "SlimDX 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 device.Clear(ClearFlags.Target, Color.Black, 1.0, 0) device.MultiplyTransform(TransformState.Projection , Matrix.PerspectiveFovLH(Math.PI / 4, _ Me.Width / Me.Height, 1.0F, 50.0F)) device.SetRenderState(RenderState.Lighting, False) device.MultiplyTransform(TransformState.View, Matrix.LookAtLH(New Vector3(0, 0, 30), New Vector3(0, 0, 0), New Vector3(0, 1, 0))) device.MultiplyTransform(TransformState.World, Matrix.Identity) Dim vertices As CustomDiffuse() = New CustomDiffuse(0 To 2) {} 'create an array of vertices vertices(0).Position = New Vector3(0, 0, 0) vertices(0).Color = Color.Blue.ToArgb vertices(1).Position = New Vector3(10, 0, 0) vertices(1).Color = Color.Yellow.ToArgb vertices(2).Position = New Vector3(5, 10, 0) vertices(2).Color = Color.Green.ToArgb Dim vertbuf As New VertexBuffer(device, vertices.Length * 16, Usage.WriteOnly, VertexFormat.Position / VertexFormat.Diffuse, Pool.Default) Dim stream As DataStream = vertbuf.Lock(0, 20, LockFlags.None) stream.WriteRange(vertices) vertbuf.Unlock() device.BeginScene() 'all drawings after this line device.SetStreamSource(0, vertbuf, 0, 16) device.VertexFormat = VertexFormat.Position / VertexFormat.Diffuse device.DrawUserPrimitives(PrimitiveType.TriangleLi st, 0, 1, vertices) device.EndScene() 'all drawings before this line device.Present() Me.Invalidate() End Sub End Class |
||||||||
|
|
|
|
#2 | ||||||||
|
Administrator
Location: UK |
You already posted on GameDev.net where one of the programmers that works on slimdx normally hangs about so I am going to close this thread.
http://www.gamedev.net/community/for...opic_id=556830
__________________
Steven Yau [Alix Games Blog] [Portfolio] [How I broke into the Games Industry] [Why I left my Games Job] [How to be a Games Tester] [Getting back into the Game] |
||||||||
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 02:29 AM.

















Linear Mode

