Page 2 of 2

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Tue May 17, 2022 7:03 pm
by skinkairewalker
hello guys, I would like to know how I do to animate a model, I'm using > OB3D_LoadAnimMesh and OB3D_Animate(1,1,0,0) but dont works ...
Can anyone give me a light ?

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Thu Jun 09, 2022 1:04 am
by Axeman
OpenB3D is based on Blitz3D and uses most of the same commands. You can find Blitz3D along with usage docs and examples at the links below.

https://kippykip.com/b3ddocs/commands/index.htm | https://blitzresearch.itch.io/blitz3d | https://nitrologic.itch.io/blitz3d

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Mon Jul 11, 2022 7:02 pm
by skinkairewalker
using the example in this documentation https://kippykip.com/b3ddocs/commands/3 ... imMesh.htm, the application runs and crashes... does anyone know what i'm doing wrong?

Code: Select all

IncludeFile "openb3d.pb"

UseJPEGImageDecoder()
UseJPEG2000ImageDecoder()

; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =600
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH, "Purebasic OpenB3D",
            #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH )

OB3D_Graphics3D( #PREVIEW_SIZEW, #PREVIEW_SIZEH, 0, 2, 60 )
OB3D_AntiAlias( 1 ) ; don't work
; *texture = OB3D_LoadTexture(#PB_Compiler_Home+"Examples\3D\Data\Textures\Dirt.jpg" ) 
*texture = OB3D_LoadTexture(GetCurrentDirectory()+"data/Gargoyle.bmp" ) 

*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 150.0, 150.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 1, -200.0 )
OB3D_RotateEntity( *camera, -10, 0, 0 )

*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*light2 = OB3D_CreateLight()
OB3D_MoveEntity( *light2, 5.0, 0.0, 0.0 )
*platform = OB3D_LoadAnimMesh("data/Gargoyle.md2")
OB3D_EntityTexture( *platform, *texture)
OB3D_RotateEntity( *platform, 80.0, 0.0, 0.0 )
OB3D_MoveEntity( *platform, 10.0, 0.0, 50.0 )


AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
; OB3D_PositionMesh(*platform, 0, -5, 0)

OB3D_Animate(*platform,2)

;Debug OB3D_AnimLength(*platform)

OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

Repeat
  Select WaitWindowEvent(1)
    Case #PB_Event_Menu
      If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
  
  OB3D_UpdateWorld()
  OB3D_RenderWorld()
  FlipBuffers() ; Use for 'OpenWindowedScreen'.
;   SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
  
ForEver
EndProgram()


Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Thu Jul 14, 2022 4:45 pm
by benubi
perhaps check your available screen resolutions, and correct the two lines

#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =600

to:

#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =768

1024 x 600 is an uncommon resolution for desktop computers and will probably not be supported by your graphics card. (800x600 may work too, tho, but I never used OB3D).

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Fri Jul 15, 2022 1:24 pm
by Axeman
The screen resolution shouldn't be an issue, as you are using windowed mode which doesn't have the limitations that fullscreen has.

Try putting some numbered 'Debug' statements in there to see if you can identify the line that is causing the crash.

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Sun Oct 29, 2023 11:11 am
by xperience2003
from where can i get the this OpenB3D framework ? i found just import for freebasic

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Fri Nov 10, 2023 6:45 pm
by skinkairewalker
Why is there a black area around the view?
screenshot : https://prnt.sc/Pb6wjO9vUPO_

code :

Code: Select all

IncludeFile "openb3d.pb"

InitSprite()
UseJPEGImageDecoder()
UseJPEG2000ImageDecoder()

; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =600
#Menu_Event_CloseWindow = 0

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH, "Purebasic OpenB3D",
            #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH )

OB3D_Graphics3D( #PREVIEW_SIZEW, #PREVIEW_SIZEH, 0, 2, 60 )
OB3D_AntiAlias( 1 ) ; don't work
; *texture = OB3D_LoadTexture(#PB_Compiler_Home+"Examples\3D\Data\Textures\Dirt.jpg" ) 
*texture = OB3D_LoadTexture(GetCurrentDirectory()+"data/dragon_gold.jpg" ) 

*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 150.0, 150.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 1, -200.0 )
OB3D_RotateEntity( *camera, -10, 0, 0 )

*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*light2 = OB3D_CreateLight()
OB3D_MoveEntity( *light2, 5.0, 0.0, 0.0 )
*platform = OB3D_LoadAnimMesh("data/Dragon.b3d")
OB3D_EntityTexture( *platform, *texture)
OB3D_RotateEntity( *platform, 80.0, 0.0, 0.0 )
OB3D_MoveEntity( *platform, 10.0, 0.0, 50.0 )


AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
; OB3D_PositionMesh(*platform, 0, -5, 0)

OB3D_Animate(*platform,2)

;Debug OB3D_AnimLength(*platform)

OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

Repeat
  Select WaitWindowEvent(1)
    Case #PB_Event_Menu
      If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
  
  OB3D_UpdateWorld()
  OB3D_RenderWorld()
 ;FlipBuffers() ; Use for 'OpenWindowedScreen'.
   SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
  
ForEver
EndProgram()



Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Fri Nov 10, 2023 8:54 pm
by Kuron
I will likely delve into this, but also want to ask has anybody written includes or wrappers for the B3D SDK?

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Mon Jan 15, 2024 3:28 pm
by skinkairewalker
this is my working code...

Code: Select all

IncludeFile "openb3d.pb"

InitSprite()
UseJPEGImageDecoder()
UseJPEG2000ImageDecoder()
ExamineDesktops()

; === DEMO ===
#MAIN_WINDOW = 0
#OPENGL_SCREEN = 0
#PREVIEW_SIZEW =1024
#PREVIEW_SIZEH =600
#Menu_Event_CloseWindow = 0
Global DeskWidth.i = DesktopWidth(0)
Global DeskHeight.i= DesktopHeight(0)

OpenWindow( #MAIN_WINDOW, 0, 0, #PREVIEW_SIZEW, #PREVIEW_SIZEH, "Purebasic OpenB3D",
            #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

;OpenWindowedScreen( WindowID( #MAIN_WINDOW ), 0, 0, #PREVIEW_SIZE, #PREVIEW_SIZE )
OpenGLGadget( #OPENGL_SCREEN, 0, 0, WindowWidth(0), WindowHeight(0) )

Debug DeskWidth
Debug DeskHeight
Debug WindowWidth(0)
Debug WindowHeight(0)

OB3D_Graphics3D( 1282, 750, 0, 2, 60 )
OB3D_AntiAlias( 1 ) ; don't work
; *texture = OB3D_LoadTexture(#PB_Compiler_Home+"Examples\3D\Data\Textures\Dirt.jpg" ) 
*texture = OB3D_LoadTexture(GetCurrentDirectory()+"data/dragon_gold.jpg" ) 

*camera = OB3D_CreateCamera()
OB3D_CameraClsColor( *camera, 400.0, 400.0, 255.0 )
OB3D_MoveEntity( *camera, 0.0, 1, -300.0 )
OB3D_RotateEntity( *camera, -20, -20, -50 )

*light = OB3D_CreateLight()
OB3D_MoveEntity( *light, 0.0, -10.0, 0.0 )
*light2 = OB3D_CreateLight()
OB3D_MoveEntity( *light2, 5.0, 0.0, 0.0 )
*platform = OB3D_LoadAnimMesh("data/Dragon.b3d")
OB3D_EntityTexture( *platform, *texture)
OB3D_RotateEntity( *platform, 80.0, 0.0, 0.0 )
OB3D_MoveEntity( *platform, 10.0, 0.0, 50.0 )


AddKeyboardShortcut( #MAIN_WINDOW, #PB_Shortcut_Escape, #Menu_Event_CloseWindow )
; OB3D_PositionMesh(*platform, 0, -5, 0)

OB3D_Animate(*platform,2)

;Debug OB3D_AnimLength(*platform)

OB3D_UpdateWorld()
OB3D_RenderWorld()
;FlipBuffers() ; Use for 'OpenWindowedScreen'.
SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.

Repeat
  Select WaitWindowEvent(1)
    Case #PB_Event_Menu
      If EventMenu() = #Menu_Event_CloseWindow : Break : EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
  
  OB3D_UpdateWorld()
  OB3D_RenderWorld()
 ;FlipBuffers() ; Use for 'OpenWindowedScreen'.
   SetGadgetAttribute( #OPENGL_SCREEN, #PB_OpenGL_FlipBuffers, #True ) ; Use for 'OpenGLGadget'.
  
ForEver
EndProgram()

I noticed some "weird" patterns, the X,Y reference point is at the bottom left (the size reference has to be based on the bottom left corner).

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Fri Feb 28, 2025 7:00 pm
by eNano
Is it possible to call the OpenB3D functions from a procedure? I try to call OB3D_createSphere() inside a procedure in the same demo of the include file and gives me

[ERROR] Invalid memory access. (write error at address 8)
The Program was killed.

Re: OpenB3D 3D DLL framework include file for PureBasic

Posted: Wed Mar 26, 2025 10:22 am
by Axeman
Here's a HTML documentation file I created for OpenB3D: http://freehandyscripts.com/stuff/OpenB3DHelp.html

You should be able to download the file by right-clicking on it and using the 'Save As', 'Save linked content', etc. option. Or open the HTML source code and save that to a HTML file.