Page 1 of 4
OGRE doesn't work
Posted: Fri May 04, 2007 11:09 am
by Sebe
I tried to get the OGRe examples to run but it seems the Load functions are broken. LoadTexture and LoadMesh don't work but the paths are correct

For example LoadTexture in combination with CreateMaterial gives me the error: The specified TextureID is null.
Posted: Fri May 04, 2007 6:24 pm
by Kale
Got any code?
Posted: Fri May 04, 2007 6:36 pm
by Sebe
Well, nothing easier than that. Just take any of the 3D examples that come with PB 4.02, like:
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Texture
;
; (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 10
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data\", #PB_3DArchive_FileSystem)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
LoadSprite(0, "Data\Background.bmp")
AmbientColor(RGB(255,255,255))
LoadMesh (0, "Robot.mesh")
CreateMaterial(0, LoadTexture(0, "r2skin.jpg"))
CreateMaterial(1, LoadTexture(1, "clouds.jpg"))
MaterialBlendingMode(1, 3) ; Alphablending for this texture
If StartDrawing(TextureOutput(0)) ; Draw a box on our texture..
Box(0,0, 100, 100, RGB(255, 0, 0))
StopDrawing()
EndIf
CreateEntity (0, MeshID(0), MaterialID(1))
CreateEntity (1, MeshID(0), MaterialID(0))
MoveEntity(1, 100, 0, 0)
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0,0,0,100)
Repeat
Screen3DEvents()
ClearScreen(RGB(0, 0, 0))
DisplaySprite(0, 0, 0)
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
If ExamineMouse()
MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
EndIf
RotateEntity(0, 1, 0, 0)
RotateEntity(1, 0.5, 0, 0)
RotateCamera(0, MouseX, MouseY, RollZ)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
Posted: Fri May 04, 2007 7:00 pm
by Fluid Byte
That means that the specific texture is either missing, damaged or in some inappropriate format.
Posted: Fri May 04, 2007 10:57 pm
by Hydrate
Are you by chance loading any of these from the help files? If so try not doing that, I had the same problem, loading it from the help file seems to load it into a tempory directory and its missing all the images etc.
Posted: Fri May 04, 2007 11:38 pm
by Sebe
The textures are fine. I took a look at them and they are ok. The path is correct as well. There are other examples (sprite) that load from the same directory and have no problems. I also load the sourcefiles directly (not from the helpfiles). So it seems the problem lies within the 3darchive functions of the 3d engine (OGRE).
Posted: Sat May 05, 2007 12:14 am
by Brice Manuel
are you making sure you put the engine DLL into the directory of the source file?
Posted: Sat May 05, 2007 12:24 am
by Fluid Byte
Brice Manuel wrote:are you making sure you put the engine DLL into the directory of the source file?
Why should he do that? He's just running sourcecode not a complied .EXE. Putting the Engine3D.dll in the sources directory is redundant because it's already in the compiler folder.
Posted: Sat May 05, 2007 12:42 am
by Brice Manuel
Fluid Byte wrote:Why should he do that?
Why shouldn't he? Obviously what he is doing isn't working. When that is the case, you should try everything.
We are dealing with Windows, right? Its not like XP is even compatible with itself. There are all kinds of obscure bugs in Windows that will let something work for most people but not for one person.
Of course one could ask why he is bothering since the 3D support in PB is useless :roll:
Posted: Sat May 05, 2007 12:48 am
by Fluid Byte
We are dealing with Windows, right? Its not like XP is even compatible with itself. There are all kinds of obscure bugs in Windows that will let something work for most people but not for one person.
Agreed!
Of course one could ask why he is bothering since the 3D support in PB is useless
Not useless, just "special". But oh well, that's another story and not the right place for such a debate.
Posted: Sat May 05, 2007 1:47 am
by Sebe
I already tried to put the engine.dll with the compiled exe in the same folder as the sourccefiles are. But the engine.dll is not the problem. I see the 3d preference option window and then even the 3d mode starts and shows me a white background with a black plane. I can even move the camera with the mouse and all. It's just the mesh and texture loading functions that are not working

Posted: Sat May 05, 2007 2:13 am
by byo
What's your video card?
Re: OGRE doesn't work
Posted: Sat May 05, 2007 6:25 am
by Comtois
Sebe wrote:I tried to get the OGRe examples to run but it seems the Load functions are broken. LoadTexture and LoadMesh don't work but the paths are correct

For example LoadTexture in combination with CreateMaterial gives me the error: The specified TextureID is null.
Have you try MeshManual.pb example ? can you see the cube ?
May be you can try MouseOver3D in my signature, i use LoadMesh and LoadTexture and they work fine here with PB4.02
Posted: Sat May 05, 2007 6:31 am
by netmaestro
All is working here.
Posted: Sat May 05, 2007 4:49 pm
by Sebe
Video Card: ATI Radeon x1600
I have tried all OGRE examples that came with PB 4.02
Will try other examples like the ones of Comtois when I'm at home again (tomorrow).
@Brice Manuel: 3D support in PB is far away from being useless. The features surpass the ones from Blitz3D (physics, stencil shadows). Hopefully OGRE will be updated soon to support DX9 and shaders.