Lack of VB.net support

Nimph

10-04-2007 06:26:11

There seems to be a big lack of vb.net support in mogre.

There are no vb.net tutorials on the mogre wiki, and I can't find any vb.net examples in the new sdk.

sh1ny

10-04-2007 20:19:45

Well i dont know about VS2005, but im pretty sure that SharpDevelop has an option of converting code from c# to vb.net . You might try that :D

Nimph

10-04-2007 23:49:51

I tried it. The conversion from c# to vb.net produced many errors

lancore89

11-04-2007 00:05:32

You can use Reflector to decompile the C#-Programs into VB.net Code.

Maybe this can help you a bit.

Nimph

11-04-2007 00:17:16

I'm not sure Reflector is what i need.

If anyone has a simple example of initializing mogre with vb.net, that would be greatly accepted.

Sweenie

11-04-2007 08:26:51


Imports Mogre

Module Main

Private mRoot As Root
Private mSceneMgr As SceneManager
Private mRenderWin As RenderWindow
Private mCamera As Camera
Private mViewPort As Viewport
Private mLogMgr As LogManager
Private mInputMgr As MOIS.InputManager
Private mKeyboard As MOIS.Keyboard
Private mMouse As MOIS.Mouse

Sub Main()

If Initialize() = False Then Exit Sub
Run()

End Sub

Function Initialize() As Boolean

mRoot = New Root()
Dim initRes As Boolean = mRoot.ShowConfigDialog()
If initRes = False Then Return False

mRenderWin = mRoot.Initialise(True, "Application")
Dim hwnd As IntPtr
mRenderWin.GetCustomAttribute("WINDOW", hwnd)

' Create the scenemanager
mSceneMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "sceneManager")

' Create the default camera
mCamera = mSceneMgr.CreateCamera("DefaultCamera")
mCamera.NearClipDistance = 1.0
mCamera.FarClipDistance = 10000.0
mCamera.Position = New Vector3(0, 0, 10)
mCamera.LookAt(0, 0, 0)

' Setup a viewport using the default camera
mViewPort = mRenderWin.AddViewport(mCamera)
mCamera.AspectRatio = mViewPort.ActualWidth / mViewPort.ActualHeight
mViewPort.BackgroundColour = New ColourValue(0.5, 0.5, 0.5, 1)

'Create input
Dim pl As MOIS.ParamList = New MOIS.ParamList
pl.Insert("WINDOW", hwnd.ToString)
mInputMgr = MOIS.InputManager.CreateInputSystem(pl)

mKeyboard = mInputMgr.CreateInputObject(MOIS.Type.OISKeyboard, True)
mMouse = mInputMgr.CreateInputObject(MOIS.Type.OISMouse, True)
Dim ms As MOIS.MouseState_NativePtr = mMouse.MouseState
ms.width = mRenderWin.Width - 1
ms.height = mRenderWin.Height - 1

' Read resources config file
Dim cf As New ConfigFile
cf.Load("resources.cfg", vbTab + ":=", True)
Dim seci As ConfigFile.SectionIterator = cf.GetSectionIterator
Dim secName As String, typeName As String, archName As String

' Normally we would use the foreach syntax, which enumerates the values, but in this case we need CurrentKey too;
While (seci.MoveNext())

secName = seci.CurrentKey
Dim settings As ConfigFile.SettingsMultiMap = seci.Current
For Each pair As KeyValuePair(Of String, String) In settings
typeName = pair.Key
archName = pair.Value
ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName)
Next
End While
ResourceGroupManager.Singleton.InitialiseAllResourceGroups()
mSceneMgr.AmbientLight = New ColourValue(1.0, 1.0, 1.0)
mLogMgr = LogManager.Singleton

AddHandler mRoot.FrameStarted, AddressOf OnFrameStarted

Return True

End Function

Sub Run()

mRoot.StartRendering()

'Dispose Input system
mInputMgr.DestroyInputObject(mKeyboard)
mInputMgr.DestroyInputObject(mMouse)
MOIS.InputManager.DestroyInputSystem(mInputMgr)

mRoot.Dispose()
mRoot = Nothing

End Sub

Function OnFrameStarted(ByVal evt As FrameEvent) As Boolean

'Update input
mKeyboard.Capture()
mMouse.Capture()

If mKeyboard.IsKeyDown(MOIS.KeyCode.KC_ESCAPE) Or _
mRenderWin.IsClosed Then Return False

Return True
End Function

End Module

Nimph

11-04-2007 22:47:19

Thanks! :D

Nimph

12-04-2007 00:59:52

Uhh. One last thing. I tried to add a simple model on using:

Dim ent As Entity = mSceneMgr.CreateEntity("ogre", "ogrehead.mesh")
Dim node As SceneNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("ogreNode")
node.AttachObject(ent)

but then it doesn't work anymore, bringing up a runtime error. And in the log is:

09:57:29: OGRE EXCEPTION(5:ItemIdentityException): Unable to derive resource group for ogrehead.mesh automatically since the resource was not found. in ResourceGroupManager::findGroupContainingResource at ..\src\OgreResourceGroupManager.cpp (line 1366)


I don't know what's going on. :(

bleubleu

12-04-2007 01:09:18

Are your resources paths setup properly ?

Look at your resource.cfg file and make sur the path to you mesh is there.

Mat

Nimph

12-04-2007 01:52:35

The resource files look ok.

bleubleu

12-04-2007 01:57:01

Ok. but anyway, this has nothing to do with mogre.

Please look at this topic : http://www.ogre3d.org/phpBB2/viewtopic.php?p=213254

Im more than happy to help you with Mogre/VB.NET/C# related questions. but this is clearly a Ogre-only question.

Mat

Nimph

12-04-2007 02:01:31

Alright.

druida

17-04-2007 19:48:54

sorted