none
How to use with VB.net the Litdev small basic API RRS feed

  • Question

  • Hello all - I have been using Small Basic for some time to give some programming intro to my daughter. However, I personally prefer VB.net for various reasons. Alas, 3D programming with VB.net is quite difficult.

    Litdev 3D engine for small basic is absolutely fantastic. Hoping to use it with VB.net, I loaded the sources with Visual Studio and had a look at it although my C# knowledges are next to none. Then, using VB.net, I did add references to SmallBasicLibrary.dll and Litdev.dll and imported Litdev.dll. I used primitives as variable types to interact with Litdev.dll and although the program presented no errors, it simply did not work in displaying 3d meshes.

    Did anybody tried using Litdev API with VB.net ?

    Thanks

    Michel

    Saturday, October 26, 2013 1:48 AM

Answers

  • It should be possible to use SmallBasicLibrary.dll and any extension dll in any .Net Language e.g. VB.Net.

    I assume you can get basic GraphicsWindow operations to work and some extension stuff (eg LDControls).

    If these are not OK, then start with these.

    If these are OK and the only issue is LD3DView, then can you post you VB code (simple test case).

    Using VS with VB you can of course debug the code and perhaps see where problems are.

    Make sure you are targeting .Net 3.5.

    EDIT

    The following works for me, targeting .Net 3.5, referencing SmallBasicLibrary.dll and LitDev.dll.

    The project type was VB Console.

    Imports Microsoft.SmallBasic.Library
    Imports LitDev
    
    Module Module1
    
        Sub Main()
            Dim gw As Integer = 500
            Dim gh As Integer = 500
            GraphicsWindow.Width = gw
            GraphicsWindow.Height = gh
            Dim view3D As Primitive = LD3DView.AddView(gw, gh, "True")
    
            Dim points As Primitive = "0.293893 -0.5 0.404509  0.475528 -0.5 0.154509  0 0.5 0  0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  0.475528 -0.5 0.154509  0.475528 -0.5 -0.154509  0 0.5 0  0.475528 -0.5 -0.154509  0 0.5 0  0 0.5 0  0.475528 -0.5 -0.154509  0.293893 -0.5 -0.404509  0 0.5 0  0.293893 -0.5 -0.404509  0 0.5 0  0 0.5 0  0.293893 -0.5 -0.404509  0 -0.5 -0.5  0 0.5 0  0 -0.5 -0.5  0 0.5 0  0 0.5 0  0 -0.5 -0.5  -0.293893 -0.5 -0.404509  0 0.5 0  -0.293893 -0.5 -0.404509  0 0.5 0  0 0.5 0  -0.293893 -0.5 -0.404509  -0.475528 -0.5 -0.154509  0 0.5 0  -0.475528 -0.5 -0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.5 -0.154509  -0.475528 -0.5 0.154509  0 0.5 0  -0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.5 0.154509  -0.293892 -0.5 0.404509  0 0.5 0  -0.293892 -0.5 0.404509  0 0.5 0  0 0.5 0  -0.293892 -0.5 0.404509  0 -0.5 0.5  0 0.5 0  0 -0.5 0.5  0 0.5 0  0 0.5 0  0 -0.5 0.5  0.293893 -0.5 0.404509  0 0.5 0  0.293893 -0.5 0.404509  0 0.5 0  0 0.5 0  "
            Dim indices As Primitive = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 "
            Dim cone = LD3DView.AddGeometry(view3D, points, indices, "", "Red", "D")
            LD3DView.AddDirectionalLight(view3D, "Pink", -1, -1, -1)
            LD3DView.AddDirectionalLight(view3D, "DarkBlue", 1, 1, 1)
            LD3DView.AddAmbientLight(view3D, "#50111111")
            LD3DView.ResetCamera(view3D, -0.5, 10, 10, 0, -1, -1, "", "", "")
        End Sub
    
    End Module
    Saturday, October 26, 2013 4:55 PM
    Moderator

All replies

  • It should be possible to use SmallBasicLibrary.dll and any extension dll in any .Net Language e.g. VB.Net.

    I assume you can get basic GraphicsWindow operations to work and some extension stuff (eg LDControls).

    If these are not OK, then start with these.

    If these are OK and the only issue is LD3DView, then can you post you VB code (simple test case).

    Using VS with VB you can of course debug the code and perhaps see where problems are.

    Make sure you are targeting .Net 3.5.

    EDIT

    The following works for me, targeting .Net 3.5, referencing SmallBasicLibrary.dll and LitDev.dll.

    The project type was VB Console.

    Imports Microsoft.SmallBasic.Library
    Imports LitDev
    
    Module Module1
    
        Sub Main()
            Dim gw As Integer = 500
            Dim gh As Integer = 500
            GraphicsWindow.Width = gw
            GraphicsWindow.Height = gh
            Dim view3D As Primitive = LD3DView.AddView(gw, gh, "True")
    
            Dim points As Primitive = "0.293893 -0.5 0.404509  0.475528 -0.5 0.154509  0 0.5 0  0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  0.475528 -0.5 0.154509  0.475528 -0.5 -0.154509  0 0.5 0  0.475528 -0.5 -0.154509  0 0.5 0  0 0.5 0  0.475528 -0.5 -0.154509  0.293893 -0.5 -0.404509  0 0.5 0  0.293893 -0.5 -0.404509  0 0.5 0  0 0.5 0  0.293893 -0.5 -0.404509  0 -0.5 -0.5  0 0.5 0  0 -0.5 -0.5  0 0.5 0  0 0.5 0  0 -0.5 -0.5  -0.293893 -0.5 -0.404509  0 0.5 0  -0.293893 -0.5 -0.404509  0 0.5 0  0 0.5 0  -0.293893 -0.5 -0.404509  -0.475528 -0.5 -0.154509  0 0.5 0  -0.475528 -0.5 -0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.5 -0.154509  -0.475528 -0.5 0.154509  0 0.5 0  -0.475528 -0.5 0.154509  0 0.5 0  0 0.5 0  -0.475528 -0.5 0.154509  -0.293892 -0.5 0.404509  0 0.5 0  -0.293892 -0.5 0.404509  0 0.5 0  0 0.5 0  -0.293892 -0.5 0.404509  0 -0.5 0.5  0 0.5 0  0 -0.5 0.5  0 0.5 0  0 0.5 0  0 -0.5 0.5  0.293893 -0.5 0.404509  0 0.5 0  0.293893 -0.5 0.404509  0 0.5 0  0 0.5 0  "
            Dim indices As Primitive = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 "
            Dim cone = LD3DView.AddGeometry(view3D, points, indices, "", "Red", "D")
            LD3DView.AddDirectionalLight(view3D, "Pink", -1, -1, -1)
            LD3DView.AddDirectionalLight(view3D, "DarkBlue", 1, 1, 1)
            LD3DView.AddAmbientLight(view3D, "#50111111")
            LD3DView.ResetCamera(view3D, -0.5, 10, 10, 0, -1, -1, "", "", "")
        End Sub
    
    End Module
    Saturday, October 26, 2013 4:55 PM
    Moderator
  • Thank you for your help - I will work into this and come back to you - thx : )

    Michel

    Saturday, October 26, 2013 9:33 PM