Page 1 of 1

Re: Compositor example

Posted: Wed Mar 13, 2013 1:47 am
by idle
It doesn't appear to work on my ubuntu 12.04 x64

crashes with invalid memory access at CreateCompositorEffect

log suggests it was all good

Code: Select all

13:41:59: Particle Renderer Type 'billboard' registered
13:41:59: Added resource location '././textures' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././programs' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././models' of type 'FileSystem' to resource group 'General'
13:41:59: Added resource location '././packs/skybox.zip' of type 'Zip' to resource group 'General'
13:41:59: Added resource location '././scripts' of type 'FileSystem' to resource group 'General'
13:41:59: Parsing scripts for resource group Autodetect
13:41:59: Finished parsing scripts for resource group Autodetect
13:41:59: Creating resources for group Autodetect
13:41:59: All done
13:41:59: Parsing scripts for resource group General
13:41:59: Parsing script StdQuad_vp.program
13:41:59: Parsing script Posterize.material
13:41:59: Parsing script Glass.material
13:41:59: Parsing script SharpenEdges.material
13:41:59: Parsing script BlackAndWhite.material
13:41:59: Parsing script Tiling.material
13:41:59: Parsing script ASCII.material
13:41:59: Parsing script OldTV.material
13:41:59: Parsing script Embossed.material
13:41:59: Parsing script Examples.material
13:41:59: Parsing script OldMovie.material
13:41:59: Parsing script NightVision.material
13:41:59: Finished parsing scripts for resource group General
13:41:59: Creating resources for group General
13:41:59: All done
13:41:59: Parsing scripts for resource group Internal
13:41:59: Finished parsing scripts for resource group Internal
13:41:59: Creating resources for group Internal
13:41:59: All done

Re: Compositor example

Posted: Wed Mar 13, 2013 6:17 am
by Samuel
Works fine on my windows 7 x64. Those effects look really nice. I especially like the old movie one.

Re: Compositor example

Posted: Wed Mar 13, 2013 6:26 am
by applePi
at first it does not run on my windows xp with a message "The 3D Engine can't be initialized" , then i have remembered the post by LuCiFeR[SD] here http://www.purebasic.fr/english/viewtop ... 76#p407686 , so after installing The Nvidia Cg Toolkit the examples works great. thanks

Re: Compositor example

Posted: Wed Mar 13, 2013 7:15 pm
by Comtois
Code updated for 5.11 beta 3.

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Compositor
;
;    (c) 2013 - Fantaisie Software
;
; ------------------------------------------------------------
;

#CameraSpeed = 2

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D(#PB_Engine3D_EnableCG)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    Add3DArchive("textures", #PB_3DArchive_FileSystem)    
    Add3DArchive("programs", #PB_3DArchive_FileSystem)
    Add3DArchive("models", #PB_3DArchive_FileSystem)
    Add3DArchive("packs/skybox.zip", #PB_3DArchive_Zip)
    Add3DArchive("scripts", #PB_3DArchive_FileSystem)
    Parse3DScripts()
    
    ; First create materials
    ;
    
    CreateMaterial(0, LoadTexture(0,"grass1.png"))
    MaterialBlendingMode(0, #PB_Material_AlphaBlend)
    CreateMaterial(1, LoadTexture(1,"Dirt.jpg"))
    
    
    ; Then create the billboard group and use the previous material
    ;
    ;-Billboard
    
    CreateBillboardGroup(0, MaterialID(0), 96, 96)
    For i = 0 To 600
      AddBillboard(#PB_Any, 0, Random(2000)-1000, Random(18) + 30, Random(2000) - 1000)
    Next i
    
    ; create ground
    
    CreatePlane(0, 2000, 2000, 40, 40, 4, 4)
    CreateEntity(0, MeshID(0), MaterialID(1))
    
    ; Add house
    LoadMesh(1, "tudorhouse.mesh")
    LoadMesh(2, "tudorhouse.mesh")
    CreateEntity(1, MeshID(1), #PB_Material_None, 0, 280, 0)
    ScaleEntity(1, 0.5, 0.5, 0.5)
    
    LoadMesh(3, "robot.mesh")
    
    CreateEntity(3, MeshID(3), #PB_Material_None, 0, 0, 300)
    StartEntityAnimation(3, "Walk")
    ScaleEntity(3, 2, 2, 2)
    
    RotateEntity(3, 0, -70, 0)
    
    ; SkyBox
    SkyBox("stevecube.jpg")
    
    ; create camera
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 200, 400, 900, #PB_Absolute)
    CameraLookAt(0, 0, 100, 0)
    
    
    CreateCompositorEffect(0, CameraID(0), "Old Movie")
    ;CreateCompositorEffect(0, CameraID(0), "Old TV")
    ;CreateCompositorEffect(0, CameraID(0), "B&W")
    ;CreateCompositorEffect(0, CameraID(0), "Glass")
    ;CreateCompositorEffect(0, CameraID(0), "Sharpen Edges")
    ;CreateCompositorEffect(0, CameraID(0), "Posterize")
    ;CreateCompositorEffect(0, CameraID(0), "ASCII")
    ;CreateCompositorEffect(0, CameraID(0), "Embossed")   
    ;CreateCompositorEffect(0, CameraID(0), "Tiling")  
    ;CreateCompositorEffect(0, CameraID(0), "Night Vision")  
    
    Repeat
      Screen3DEvents()
      
      If ExamineMouse()
        MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
        MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
      EndIf
      
      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
      
      RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
      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

Re: Compositor example

Posted: Wed Mar 13, 2013 7:35 pm
by idle
still gets an IMA with CreateCompositorEffect(0, CameraID(0), "Old Movie")
on ubuntu 12.04 x64

Re: Compositor example

Posted: Wed Mar 13, 2013 7:59 pm
by IdeasVacuum
Does this require a DirectX environment or can it also be used with OpenGL?

Re: Compositor example

Posted: Wed Mar 13, 2013 8:06 pm
by LuCiFeR[SD]
works fine with the opengl subsystem for me in windows anyway, not tested elsewhere