An issue with texture loading
Posted: Fri Feb 20, 2009 7:25 pm
Hey there, I have just been taking up some more programming and having trouble already. I am developing a program that does a nice smooth 3D display of my images, but every image I load comes up really weird, as if it has been shrunk then stretched. I was wondering if anyone knew what was wrong with my code. What I have written already is this:
If anyone could help, that would be great ![Smile :)](./images/smilies/icon_smile.gif)
Code: Select all
Imports IrrlichtNETCP
Imports IrrlichtNETCP.Inheritable
Module Main
Dim device As IrrlichtDevice
Sub Main()
Dim dt As DriverType = DriverType.Direct3D8
Dim aa As Boolean = True
Dim width As Integer = My.Computer.Screen.Bounds.Width
Dim height As Integer = My.Computer.Screen.Bounds.Height
Dim colourdepth As Integer = 32
Dim img As String = "C:/mypicture.png"
device = New IrrlichtDevice(dt, New Dimension2D(width, height), colourdepth, True, True, True, aa)
Dim smgr As SceneManager = device.SceneManager
Dim driver As VideoDriver = device.VideoDriver
Dim rectangle As IrrlichtNETCP.BillboardSceneNode = smgr.AddBillboardSceneNode(smgr.RootSceneNode, New Dimension2Df(width, height), 1)
rectangle.Position = New Vector3D(0, 0, 550)
rectangle.SetMaterialType(MaterialType.TransparentAddColor)
rectangle.SetMaterialTexture(0, driver.GetTexture(img))
rectangle.SetMaterialFlag(MaterialFlag.Lighting, False)
rectangle.SetMaterialFlag(MaterialFlag.ZBuffer, False)
Dim camera As CameraSceneNode = smgr.AddCameraSceneNode(smgr.RootSceneNode)
camera.Position = New Vector3D(0, 0, 0)
camera.Rotation = New Vector3D(0, 0, 0)
While device.Run
device.VideoDriver.BeginScene(True, False, New Color(0, 0, 0, 0))
device.SceneManager.DrawAll()
device.GUIEnvironment.DrawAll()
device.VideoDriver.EndScene()
Threading.Thread.Sleep(50)
End While
End Sub
End Module
![Smile :)](./images/smilies/icon_smile.gif)