Page 1 of 2

cannot see OGRE mesh?

Posted: Wed Jan 19, 2011 5:06 pm
by Rook Zimbabwe
OK so I just want to see my mesh item on the screen... I cannot!

I have modified the PB example mesh program to load MY mesh (and taken out the texture stuff as I thought it was not needed in mesh if the object mesh HAD texture??? (oh WHY cannot we use 3ds or b3d???) but I cannot see it.

Code: Select all

;
'corrected code below
What amd I doing wrong?

Mesh and texture and mesh build files are here:
http://www.bluemesapc.com/Downloads/wheel2.zip

:mrgreen:

Re: cannot see OGRE mesh?

Posted: Wed Jan 19, 2011 5:08 pm
by IdeasVacuum
Could it be that the version of your mesh is greater than the version that PB currently supports?

Re: cannot see OGRE mesh?

Posted: Wed Jan 19, 2011 5:13 pm
by Rook Zimbabwe
I am do not think so? They haven't updated the ogremeshbuilder yet and UU3d does not generate beyond 1.0 for all I know!

Re: cannot see OGRE mesh?

Posted: Wed Jan 19, 2011 5:43 pm
by DarkDragon
Then play around with ScaleEntity a bit and you should create a material with colors if you don't use a texture. A texture isn't inside the meshfile itself (that would be really a problem as you'd safe the textures in a redundant way over all meshes). Its specified in the material file referencing the mesh.

Re: cannot see OGRE mesh?

Posted: Wed Jan 19, 2011 11:05 pm
by Rook Zimbabwe
The following code works with certain provisos:

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Mesh (Skeleton Animation)
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;

IncludeFile "Screen3DRequester.pb" ; why can I not go around this???

InitSprite()
InitKeyboard()
InitMouse()

Define.f KeyX, KeyY, MouseX, MouseY

#WheelMesh    = 0
#WheelTexture = 0
#Wheel        = 0


If InitEngine3D()
  
  Add3DArchive("Data", #PB_3DArchive_FileSystem)
  ; having to use this or suffer NO MESH/Textures is STUPID!
  
  If Screen3DRequester() ; WTF??? why does this NOT work when removed... SLOPPY IDEAS
    
    LoadMesh   (#WheelMesh   , "wheel2.mesh")
    LoadTexture(#WheelTexture, "Image1.jpg")
    
    CreateMaterial(0, TextureID(#WheelTexture))
    
    CreateEntity(#Wheel, MeshID(#WheelMesh), MaterialID(0))
    EntityMaterial(#Wheel, MaterialID(0))
    
    DisableMaterialLighting(0, 1)
    
    MaterialAmbientColor(0, RGB(100, 100, 100))
    MaterialSpecularColor(0, RGB(255, 255, 255))
    ScrollMaterial(0, 0.15, 0, 1)
    
    CreateLight(0, RGB(0,0,255), 100.0, 0, 0)
    LightSpecularColor(0, RGB(255, 0, 0))
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,100)
    ; CameraBackColor(0, RGB(0, 0, 255))
    
    Repeat
      Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
      
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -1
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 1
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -1
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 1
        Else
          KeyY = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_PageUp)
          RollZ = 3
        Else
          RollZ = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Add)
          Frame.f+0.005
        EndIf
        
      EndIf
      
      If ExamineMouse()
        MouseX = -MouseDeltaX()/10
        MouseY = -MouseDeltaY()/10
      EndIf
      
      RotateEntity(#Wheel, 0, 1, 0, #PB_Relative)
      
      RotateCamera(0, MouseY, MouseX, RollZ, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      RenderWorld()
      ;Screen3DStats() ; I have no idea what these are
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End
WHY doesn't it work if I try to change it and just open a windowed screen?
WHY do I HAVE to use a folder called Data to store models and textures?
Where is the lighting?

I think I am liking Ogre less as I am not impressed yet! B3D was easier and MM3D (a ripoff of B3D?) was as easy...

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 9:42 am
by DarkDragon
Rook Zimbabwe wrote:WHY doesn't it work if I try to change it and just open a windowed screen?
WHY do I HAVE to use a folder called Data to store models and textures?
Where is the lighting?
OpenWindowedScreen works just well here. Maybe you forgot to check the window events in the mainloop?
For the current folder use:

Code: Select all

Add3DArchive(".", #PB_3DArchive_FileSystem)
And for lighting you should remove
Rook Zimbabwe wrote:

Code: Select all

DisableMaterialLighting(0, 1)
This one works very well:

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Mesh (Skeleton Animation)
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Modified by Rook Zimbabwe
;             and DarkDragon (in order to help Rook Zimbabwe)

InitSprite()
InitKeyboard()
InitMouse()

Define.f KeyX, KeyY, MouseX, MouseY

#WheelMesh    = 0
#WheelTexture = 0
#Wheel        = 0


If InitEngine3D()
 
  Add3DArchive(".", #PB_3DArchive_FileSystem)
  ; having to use this or suffer NO MESH/Textures is STUPID!
 
  OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Test", #PB_Window_SystemMenu)
  If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0) ; WTF??? why does this NOT work when removed... SLOPPY IDEAS
   
    LoadMesh   (#WheelMesh   , "wheel2.mesh")
    LoadTexture(#WheelTexture, "Image1.jpg")
   
    CreateMaterial(0, TextureID(#WheelTexture))
   
    CreateEntity(#Wheel, MeshID(#WheelMesh), MaterialID(0))
    EntityMaterial(#Wheel, MaterialID(0))
   
;     DisableMaterialLighting(0, 1)
   
    MaterialAmbientColor(0, RGB(100, 100, 100))
    MaterialSpecularColor(0, RGB(255, 255, 255))
    ScrollMaterial(0, 0.15, 0, 1)
   
    CreateLight(0, RGB(0,0,255), 100.0, 0, 0)
    LightSpecularColor(0, RGB(255, 0, 0))
   
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,100)
    ; CameraBackColor(0, RGB(0, 0, 255))
   
    Repeat
;       Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
     
      If ExamineKeyboard()
       
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -1
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 1
        Else
          KeyX = 0
        EndIf
       
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -1
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 1
        Else
          KeyY = 0
        EndIf
       
        If KeyboardPushed(#PB_Key_PageUp)
          RollZ = 3
        Else
          RollZ = 0
        EndIf
       
        If KeyboardPushed(#PB_Key_Add)
          Frame.f+0.005
        EndIf
       
      EndIf
     
      If ExamineMouse()
        MouseX = -MouseDeltaX()/10
        MouseY = -MouseDeltaY()/10
      EndIf
     
      RotateEntity(#Wheel, 0, 1, 0, #PB_Relative)
     
      RotateCamera(0, MouseY, MouseX, RollZ, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
     
      RenderWorld()
      ;Screen3DStats() ; I have no idea what these are
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent() = #PB_Event_CloseWindow
  EndIf
 
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End
Rook Zimbabwe wrote:I think I am liking Ogre less as I am not impressed yet! B3D was easier and MM3D (a ripoff of B3D?) was as easy...
Its your opinion, but don't spread it like if you are a dictator who wants to tell others what they should use. That's just unprofessional and don't tell me it doesn't matter for spare-time-programmers.

And now I lost the rest of my sparetime.

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 10:24 am
by Innesoft
I think I am liking Ogre less as I am not impressed yet! B3D was easier and MM3D (a ripoff of B3D?) was as easy...
Ogre is a decent engine, it's just a *very* limited implementation in PB. Word is, Fred & co are working on a better Ogre/PB for a future update, but currently it's not really an option, as PB is an application/UI language with some 3D glued on as an afterthought.

MM3D is basically just a DirectX9 wrapper with B3d-like functions, and is far from complete.

:arrow: N3xtD is your best choice for PB at the moment, even if it's buggy in places (which you can fix, recompile or work around in VS) - get Build 20, or better still, ask around for the source (source-engine.zip) that you can work with yourself. TMyke doesn't seem to be updating it anymore, but I plan to share my fixes/updates at some point.

Final option is to wrap Ogre or Irrlicht yourself, but that's a lot of work.

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 3:23 pm
by chi
Have you tried Xors3d yet?
It´s easy like B3D... http://www.purebasic.fr/english/viewtop ... 27&t=44942

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 7:59 pm
by Rook Zimbabwe
MM3D is basically just a DirectX9 wrapper with B3d-like functions, and is far from complete.
That is the thing... with MM3d I am thinking it is maybe just a fancy wrapper for B3D with a physics engine included... the model looks JAGGY at 800X600 compared to the ogre mesh model... perhaps that is the b3d file but since both generate a vector I don't know... Before my mm3d post the last post on the mm3d column was 2005... so I figure it isn't maybe going anywhere fast unless you know something new?

Xors3D... nope... is it a DLL for PB? I have Blitz3D but I want to code most of this in PB since I already coded it in B3D. And at $100.00 a license... they LOST me as a customer unless there is a severe featureset that does everything but walk the dog for me! Including time limit demo creation and trial to main registrer functions...

N3xtD looked good but work stopped so I stopped playing with it.

iRRlicht is out as it is too difficult to deal with.

Just stuck!

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 8:16 pm
by DarkDragon
:( :cry: Rook: no comments on my answer to your problems? And therefore I lost my sparetime ... .

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 8:48 pm
by Rook Zimbabwe
Actually Daniel I consider that a fantastic application of your spare time! I have taken your ideas and started to stumble with them myself...

Now attempting to display text as well... big waste of MY time as I cannot seem to print anything on screen using HUD or other... still trying and THAT has kept me from thanking you (I was sooo happy to have a new toy to play with!) :D

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 8:50 pm
by Rook Zimbabwe
so far:

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Mesh (Skeleton Animation)
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
; Modified by Rook Zimbabwe
;             and DarkDragon (in order to help Rook Zimbabwe)

IncludeFile "Screen3DRequester.pb" ; why can I not go around this???

InitSprite()
InitKeyboard()
InitMouse()


Define.f KeyX, KeyY

#WheelMesh = 0
#WheelMesh2 = 1
#WheelMesh3 = 2
#WheelMesh4 = 3
#WheelTexture = 0
#Wheel = 0
#Wheel2 = 1
#Wheel3 = 2
#Wheel4 = 3
#Sun = 1
#a3Dtext = 2


If InitEngine3D()

  Add3DArchive(".", #PB_3DArchive_FileSystem)
  ; having to use this or suffer NO MESH/Textures is STUPID!

  OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Test", #PB_Window_SystemMenu)
    
  If OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 1, 0, 0) ; WTF??? why does this NOT work when removed... SLOPPY IDEAS
     
  Add3DArchive("Data", #PB_3DArchive_FileSystem)
  ; having to use this or suffer NO MESH/Textures is STUPID!
  
 
    LoadMesh   (#WheelMesh   , "wheel2.mesh")
    LoadTexture(#WheelTexture, "Image1.jpg")
    CopyMesh(#WheelMesh , #WheelMesh2 )
    CopyMesh(#WheelMesh2 , #WheelMesh3 )
    CopyMesh(#WheelMesh3 , #WheelMesh4 )
    
    CreateMaterial(0, TextureID(#WheelTexture))
    
    CreateEntity(#Wheel, MeshID(#WheelMesh), MaterialID(0))
    EntityMaterial(#Wheel, MaterialID(0))
    CreateEntity(#Wheel2, MeshID(#WheelMesh2), MaterialID(0))
    EntityMaterial(#Wheel2, MaterialID(0))
    CreateEntity(#Wheel3, MeshID(#WheelMesh3), MaterialID(0))
    EntityMaterial(#Wheel3, MaterialID(0))
    CreateEntity(#Wheel4, MeshID(#WheelMesh4), MaterialID(0))
    EntityMaterial(#Wheel4, MaterialID(0))
    
    EntityLocate(#Wheel, 11, 0, 0)
    EntityLocate(#Wheel2, 0, 0, 0)
    EntityLocate(#Wheel3, -11, 0, 0)
    EntityLocate(#Wheel4, -22, 0, 0)
    
    DisableMaterialLighting(0, 0) ; was (0,1)
    
    MaterialAmbientColor(0, RGB(100, 100, 100))
    MaterialSpecularColor(0, RGB(255, 255, 255))
    ;ScrollMaterial(0, -0.45, 0, 1) ; 0, 0.15, 0, 1)
    
    CreateLight(#Sun, RGB(255,255,255), 0, 260, 0) ; 100.0, 0, 0)
    LightSpecularColor(#Sun, RGB(128, 128, 128))
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,97)
    
    Repeat
      Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
      
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -1
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = 1
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -1
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = 1
        Else
          KeyY = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_PageUp)
          RollZ = 3
        Else
          RollZ = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Add)
          Frame.f+0.005
        EndIf
        
      EndIf
      
      
      RotateEntity(#Wheel, 1, 0, 0, #PB_Relative) ;#Wheel, 0, 1, 0, #PB_Relative)
      xx = EntityX(#Wheel)
      yy = EntityY(#Wheel)
      zz = EntityZ(#Wheel)

      
      RenderWorld()
      ;Screen3DStats() ; I have no idea what these are
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 9:14 pm
by chi
But what is it, that you don´t like about Xors3d?
Is it... The same syntax like B3D, which would makes it very easy to convert your current code to xors3d?... Or the fact, that you have to pay $100 for an engine with good support, where the author(s) don´t stop the development (like N3xtD) after a while? Just curious ;)

Don´t get me wrong, it´s your decision... But for me (and atm) Xors3d is the best way to work with a good dx9 engine within PB.

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 9:17 pm
by Rook Zimbabwe
unemployed and no paycheck! Welcome to America where we send all our jobs all over the world but NOT here!!!

Re: cannot see OGRE mesh?

Posted: Thu Jan 20, 2011 9:30 pm
by chi
Ok, point taken... I´m sorry to hear
Maybe you´ve just to wait for the new Ogre implementation with Pb4.? ;)