Page 1 of 1

Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 12:36 am
by falsam

Code: Select all

EnableExplicit

Enumeration 10
  #Camera
  #Light
  
  #Cube
  #Cube_Mesh
  
  #Cylindre
  #Cylindre_Mesh
  
  #Sphere
  #Sphere_Mesh
  
  #Ground
  #Ground_Mesh
EndEnumeration


Global Entity.i, RotX.i, RotY.i, RotZ, i.f, Sense.s="Right"
If InitEngine3D()
  InitSprite()
  InitKeyboard()
  InitMouse()

  OpenWindow(0,0,0,800,600,"3d",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)

  WorldShadows(#PB_Shadow_Additive)

  EnableWorldPhysics(1) 

  CreateCamera(#Camera,0,0,800,600)
  CameraLocate(#Camera,5,5,-20)
  CameraLookAt(#Camera,5,5,0)
  CreateLight(#Light,RGB(255,255,255),0,50,-20)

  CreateCylinder(#Cylindre_Mesh, 1, 5) 
  CreateEntity(#Cylindre, MeshID(#Cylindre_Mesh), #PB_Material_None)
  EntityLocate(#Cylindre, 1, 1,0)
  RotateEntity(#Cylindre, 90, 0, 90)

  CreateCube(#Cube_Mesh, 1)
  CreateEntity(#Cube, MeshID(#cube_Mesh), #PB_Material_None)
  ResizeEntity(#Cube, 15, 0.2, 5)
  EntityLocate(#Cube, 1, 2.2, 0)
  RotateEntity(#Cube, 0, 0, -18)
  EntityPhysicBody(#Cube, #PB_Entity_StaticBody, 2, 0, 0)

  CreateSphere(#Sphere_Mesh, 1) 
  CreateEntity(#Sphere, MeshID(#Sphere_Mesh), #PB_Material_None)
  EntityLocate(#Sphere, -1, 6,0)
  EntityPhysicBody(#Sphere, #PB_Entity_BoxBody, 1, 0, 1)

  CreateCube(#Ground_Mesh, 20)
  CreateEntity(#Ground,MeshID(#Ground_Mesh), #PB_Material_None)
  EntityLocate(#Ground,5,-10,-5)
  EntityPhysicBody(#Ground, #PB_Entity_StaticBody, 1, 0, 0)

  Repeat
   RenderWorld()
  
    ;Balançoire
   If i<18 And Sense="Right"
     i + 0.3
   Else
     Sense="Left"
   EndIf
  
  
   If i>-18 And Sense="Left"
    i - 0.3
   Else
    Sense="Right"
   EndIf
   RotateEntity(#Cube, 0, 0, i)
   
   If ExamineMouse()
     RotY = -MouseDeltaX()/10 
     RotX = -MouseDeltaY()/10  
   EndIf
       
   RotateCamera(#Camera, RotX, RotY, RotZ, #PB_Relative)
  
   FlipBuffers()
  
   ExamineKeyboard() 
   If KeyboardPushed(#PB_Key_Escape)
     End
   EndIf
  
 ForEver
Else
  MessageRequester("Information", "Impossible d'initialiser le moteur 3D")
EndIf
 

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 5:15 pm
by Demivec
I get an IMA when running this code at line 70 (@RenderWorld()). I'm running x86 using DirectX9. ASCII.

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 5:34 pm
by falsam
I'm running x86 using DirectX11 and I have no error.

Window 7 ? Window XP ?

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 5:38 pm
by Demivec
falsam wrote:I'm running x86 using DirectX11 and I have no error.

Window 7 ? Window XP ?
Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 5:40 pm
by Kuron
Demivec wrote: Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.

XP does not support DX11. XP only supports up to DX9.

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 5:51 pm
by Demivec
Kuron wrote:
Demivec wrote: Window XP. I would presume the changes in DirectX11, and their lack in DirectX9, are responsible for the crash.

XP does not support DX11. XP only supports up to DX9.
@Kuron: Yes, it was apparent to me when the target compilation was for Windows 7. :wink:

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 6:02 pm
by falsam
I restart my computer with Windows XP and I test. :)

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 6:38 pm
by c4s
Same setup as Demivec here (XP, x86) but no crash. Works fine, except of stuttering camera on slow mouse movements. :wink:

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 6:59 pm
by Demivec
I did get it to function using the OpenGL subsystem.

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Oct 18, 2011 8:56 pm
by falsam
Windows 7, DirectX 11: This code works
Window XP, DirectX 9.0C : This code works

Re: Swing (PB Version 4.60 RC2 Only)

Posted: Tue Nov 22, 2011 2:58 pm
by bembulak
Works here on my Win XP SP3/32 bit box,
but unfortunately my Minx Linux 10 Box crashes on RenderWorld()!
:(