Problems with Basic Tutorial #2

Thellis

14-10-2006 05:39:44

OgreDotNet Basic Tutorial 2

Link didnt exist, but now it does :)
Wiki link updated ;)

Thellis

14-10-2006 05:43:12

Righto, now that I have mad this topic, I got a problem :(
Im using SharpDevelop and VB with .NET Framework SDK 2.0

Basically, Ive written up all the code and made it VB code rather than C# and i have a problem...

Exception System.AccessViolationException was thrown in debuggee:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.l

AddViewport()
CreateViewPort() - C:\Documents and Settings\user\My Documents\SharpDevelop Projects\My Ogre Tutorial 2\Main.vb:51,8
Setup()
Start()
Main() - C:\Documents and Settings\user\My Documents\SharpDevelop Projects\My Ogre Tutorial 2\Main.vb:60,13


Will update the wiki with VB code when I get this fixed :)

Imports System
Imports System.Drawing
Imports OgreDotNet
Imports Math3D
Namespace TutorialApplication2
Public Class TutorialApplication
Inherits ExampleApplication
Protected Overrides Sub CreateScene()
mSceneManager.SetAmbientLight(color.Black)
mSceneManager.SetShadowTechnique(ShadowTechnique.ShadowTypeStencilAdditive)

'Ninja entity
Dim ent1 As Entity=mSceneManager.CreateEntity("ninja","ninja.mesh")
ent1.SetCastShadows(False)
mSceneManager.GetRootSceneNode().CreateChildSceneNode().AttachObject(ent1)

'Ground plane
Dim plane As Plane=New Plane(Vector3.UnitY,0)
MeshManager.GetSingleton().CreatePlane("ground",ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,plane,1500,1500,20,20,True,1,5,5,Vector3.UnitZ)

'Ground entity
Dim ent2 As Entity=mSceneManager.CreateEntity("groundEntity","ground")
ent2.SetMaterialName("Examples/Rockwall")
ent2.SetCastShadows(False)

'Lights
Dim light1 As Light=mSceneManager.CreateLight("light1")
light1.SetLightType(Light.LightTypes.Point)
light1.SetPosition(0,150,250)

light1.SetDiffuseColour(color.Red)
light1.SetSpecularColour(color.Red)

End Sub

Protected Overrides Sub CreateCamera()
Dim mCamera As Camera=mSceneManager.CreateCamera("PlayerCam")

mCamera.SetPosition(New Vector3(0,10,500))
mCamera.LookAt=New Vector3(0,0,0)
mCamera.SetNearClipDistance(5)
End Sub

Protected Overrides Sub CreateViewport()
Dim vp As Viewport=mRenderWindow.AddViewport(mCamera)

vp.SetBackgroundColour(color.Black)
mCamera.SetAspectRatio(vp.GetActualWidth()/vp.GetActualHeight())
End Sub
End Class
Module main
Public Sub Main()
Dim app As New TutorialApplication
app.Start()
End Sub
End Module
End Namespace

Thellis

21-10-2006 04:12:01

Anybody? I can post that same code in C# if it's needed, just tell me what to post because atm Im thinking nobody knows how to troubleshoot this basic tutorial ;)