Page 2 of 2

Re: cannot see OGRE mesh?

Posted: Fri Jan 21, 2011 2:10 pm
by marc_256
Hi Rook Zimbabwe,
unemployed and no paycheck! Welcome to America where we send all our jobs all over the world but NOT here!!!
Well, I am unemployed for more than one year now (In Belgium) and no paycheck here to.
Belgium is also not the place to be ...
I try to make some money as a self employed 3D software developer !!! ???

About OGRE3D,
I played with it for a time now, but it is not well implemented in PB so,
I studying OGRE for use within C++, but I have to study C++ also ...

I like to use PB for my CAD modeling and simulator software .
Is it not time to build an open source 3D engine software for PB ?

I am also writing an C++ to PB converter software (in PB),
It works for about 40% now and the rest I have to convert by hand,
but it is growing ...

marc,

Re: cannot see OGRE mesh?

Posted: Fri Jan 21, 2011 6:26 pm
by DarkDragon
Rook Zimbabwe wrote: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
Usually you would create a spritebased font and draw the text with it (clipsprite ...). That's trivial but if you really want to use the purebasic functions try this:

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

#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)
    
    CreateSprite(0, 128, 32)
   
    Repeat
      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
      
      StartDrawing(SpriteOutput(0))
      DrawingMode(#PB_2DDrawing_AllChannels | #PB_2DDrawing_Transparent)
      Box(0, 0, SpriteWidth(0), SpriteHeight(0), RGBA(255, 255, 255, 0))
      DrawText(0, 0, "Framerate: " + StrD(Engine3DFrameRate(#PB_Engine3D_Average), 1), RGBA(255, 255, 255, 255))
      StopDrawing()
      
      DisplaySprite(0, 10, 10)
      
      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
Maybe you also want to have a look at this:
http://www.bradan.eu/files/choppergame.zip

It shows some workarounds for some of the purebasic ogre bugs. Comtois also posted some workarounds.