OGRE doesn't work

Advanced game related topics
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

OGRE doesn't work

Post 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.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Got any code?
--Kale

Image
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

Post 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
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

That means that the specific texture is either missing, damaged or in some inappropriate format.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Post 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.
.::Image::.
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

Post 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).
Brice Manuel

Post by Brice Manuel »

are you making sure you put the engine DLL into the directory of the source file?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post 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.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Brice Manuel

Post 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:
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post 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.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

Post 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 :?
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

What's your video card?
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: OGRE doesn't work

Post 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
Please correct my english
http://purebasic.developpez.com/
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

All is working here.
BERESHEIT
Sebe
Enthusiast
Enthusiast
Posts: 160
Joined: Sun Dec 19, 2004 10:55 pm
Location: Munich
Contact:

Post 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.
Post Reply