PDA

View Full Version : OpenB3D Engine Wrapper for ThinBasic (open testing)



Artemka
12-03-2013, 20:59
Hello everybody!

Here is my wrapper of OpenB3D for thinBasic. OpenB3D is based on MiniB3D and use OpenGL for graphics rendering.

Some Features:

Repeats almost all features Blitz3D;
Allows you to load *.b3d files (with animations) and *.3ds (only static) 3D model formats;
Allows you to load *.bmp, *.jpg, *.png, *.tga texture formats;

How to use:

Extract openb3d.dll and openb3d.tbasici in your project folder;
In your main source place the line #INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici";


Sample using TBGL + Openb3D:

Uses "TBGL"
#INCLUDE "%APP_SOURCEPATH%\openb3d.tbasici"

%NO_PARENT = 0 As Byte

Function TBMain()
Local hWnd As DWord

Local CAM, LIGHT, MESH As DWord

' -- Create and show window
hWnd = TBGL_CreateWindowEx("OpenB3D 0.6 - press ESC to quit", 1280, 720, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
Graphics3D(1280, 720, 32, 2, 60)

CAM = CreateCamera(%NO_PARENT)
LIGHT = CreateLight(1, %NO_PARENT)
MESH = CreateCube(%NO_PARENT)

PositionEntity(CAM, 0.0, 0.0, -25.0, %FALSE)
PositionEntity(LIGHT, 0.0, 5.0, 0.0, %FALSE)

' -- Resets status of all keys
TBGL_ResetKeyState()

' -- Main loop
While TBGL_IsWindow(hWnd)

TBGL_ClearFrame

TurnEntity(MESH, 0.3, 0.1, 0.15, %FALSE)

RenderWorld()

TBGL_DrawFrame

' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While

Wend

' -- Clear OpenB3D res
ClearWorld(%TRUE, %TRUE, %TRUE)
TBGL_DestroyWindow
End Function

8154

Here is Keywords list for syntax highlighting in thinAir IDE.

For syntax highlighting replace thinBasic_Keywords_Usr.ini in C:\thinBasic\thinAir\Syntax\thinBasic path with attached thinBasic_Keywords_Usr.ini.

8155

ReneMiner
12-03-2013, 21:27
Great! Thanx for the nice present. Something new to play with :)

You don't have by any chance some link to any documentation of the OpenB3D-Library?

It would fit here.

Artemka
12-03-2013, 21:52
Great! Thanx for the nice present. Something new to play with :)

You don't have by any chance some link to any documentation of the OpenB3D-Library?

It would fit here.

You should use Blitz3D docs. OpenB3D fully suport all 3d features of blitz3D, but no 2d. In future i try to port some examples from blitz to openb3d.

ErosOlmi
12-03-2013, 23:23
Dear Artemka,

wow ... what an entrance in thinBasic community forum!
Thanks a lot for this porting and for letting us know.

Ciao
Eros

Artemka
12-03-2013, 23:38
Dear Artemka,

wow ... what an entrance in thinBasic community forum!
Thanks a lot for this porting and for letting us know.

Ciao
Eros

Glad to try to help out. Although there are still some difficulties in sharing TBGL Sprites with OpenB3D.