OpenB3D Installation Manual?

Started by Midimaster, November 30, 2021, 16:36:05

Previous topic - Next topic

Midimaster

Hi, I use BlitzMax NG and want to restart writing harmless 3D-games. In former times I used the module "MiniB3D" from Simon together with old BlitzMax.

Now I want to restart, but I have a lot of questions... As I understood I need two things: OpenB3D and the OpenB3D-wrapper?

1. Is there a complete ZIP-file to download OpenB3D? Together with the wrapper?

2. Is there a installation guide for newbies?

3. Is the OpenB3D the "most advanced version" of the old B3D? Is the software still being maintained?

As I understood both authors are still members of the forum?


thanks
...back from Egypt

Amon

Go here and download BlitzMax-ng https://github.com/bmx-ng/bmx-ng/releases/download/v0.129.3.45.win32/BlitzMax_win32_0.129.3.45.7z

Go here and download OPenB3D https://github.com/markcwm/openb3d.mod

Go here and download BLide https://lemonbytes.com/legacy/

Put OpenB3D in your BlitzMax-ng mod folder.

Fire up Blide. Build the openB3D module only, after it builds, create a new solution in BLide, managed or unmanaged, unmanaged means you are responsible for importing the correct modules into your main bmx file.

When that's done, add this and program away:

SuperStrict

Import openb3d.b3dglgraphics


Graphics3D(1366, 768, 32, 0)


While Not KeyHit(KEY_ESCAPE)
   

   
   GCCollect()

WEnd

Midimaster

Oh.. this looks comfortable..

I (of course) already use BlitzMax NG, so I need only the  2 other files.

. but... is BLIDE a must?


...back from Egypt

Amon

BLide is deffo not a must. It's just a nice IDE to code in still.

markcwm

Hi Midimaster,

QuoteAs I understood I need two things: OpenB3D and the OpenB3D-wrapper?

The Openb3d library by Angros is wrapped in two modules Openb3dlib.mod (C++ source) and Openb3d.mod (Blitzmax core functions). They're grouped in the Openb3d.mod modscope.

Quote1. Is there a complete ZIP-file to download OpenB3D? Together with the wrapper?

Already answered by Amon, but you will need the examples which are in a separate folder Openb3d.docs, they run from anywhere in your Blitzmax install
https://github.com/markcwm/openb3d.docs

Quote2. Is there a installation guide for newbies?
Just what's in the Git Readme, see under Installation
https://github.com/markcwm/openb3d.mod

Quote3. Is the OpenB3D the "most advanced version" of the old B3D? Is the software still being maintained?
Do you mean miniB3D or Blitz3D? It's not as good as Blitz3D, if you port anything complex it probably won't run, overall though it is the most complete version of miniB3D that I know of.

It is still buggy and missing a lot of features but I am still working on them, I'm currently fixing Terrains. You can post issues you find to Github Openb3d.mod. Extra modules by others are now in Openb3dex.mod, it has a Particle Candy module (should be adding more to this) and a miniB3D 3D sound module (finished), and Krischan's framework will be added there. The Newton wrapper has only primitives implemented, but I have a copy of Itmbin's source who wrote the Newton DLL for Blitz3D. The Assimp wrapper works but no animations, it could do with a rewrite to wrap the fields properly, but I'm not sure what to do with it at the moment, so I will look at porting the glTF loader from Monkey2 first.

QuoteAs I understood both authors are still members of the forum?
Yes, Angros posted recently about a webGL port he was working on.

Midimaster

#5
Thank you for the detailed informations. Now I was able to install OpenB3D-NG and run a first app:

This is a minimal example for getting a view into a 3D-world made by OpenB3D:
Code (BlitzMax) Select
SuperStrict
Import openb3d.b3dglgraphics

Graphics3D(800, 600,32,-1)
Global Camera:TCamera = CreateCamera()
MoveEntity Camera, 0,0,-9

Global Cube:TEntity = CreateCube()
Global Light:TEntity = CreateLight()
MoveEntity Light,-5,-5,-8

While Not KeyHit(KEY_ESCAPE)
AmbientLight 50,40,30
TurnEntity Cube, 0.01, 0.02, 0.03
UpdateWorld
RenderWorld()
Flip 0
'GCCollect()
Wend


But there are some questions....
1.
Amon added a "GCCollect" to his example code within the Mainloop. Is this a must? Because without this it runs 10times faster.

2.
CreateCamera() returns a TCamera-Object. When should I use this TCamera when calling it as a TEntiyty also works. f.e. "MoveEntity Camera...".
3.
I still have to use the procedural way of using the entities. Wouldnt it be better to use:
Camera.Move...


...back from Egypt

Amon

I only added gcCollect because I saw it in an example I think on GitHub. I don't know if it is mandatory if you are cleaning up instead of the GC doing it for you. And, yes, download BLide and all IDE worries will go away. :)

This is how I'm currently moving things in OpenB3D.Global Phobos:TMesh = LoadMesh("data/Phobos.obj")
Global pPivot:TEntity = CreatePivot()
Phobos.SetParent(pPivot)
Phobos.collision_type = 1
PositionEntity(pPivot, 0, -4, 10)
RotateEntity(pPivot, -20, 0, 0)
Global Light:TEntity = CreateLight()
MoveEntity light, -5, -5, -8

Global pVecX:Float = pPivot.EntityX
Global pVecY:Float = pPivot.EntityY
Global pVecZ:Float = pPivot.EntityZ

While Not KeyHit(KEY_ESCAPE)




        AmbientLight 50, 40, 30
If KeyDown(KEY_LEFT)
pVecX = pVecX - 0.01
PositionEntity(pPivot, pVecX, pVecY, pVecZ)
ElseIf KeyDown(KEY_RIGHT)
pVecX = pVecX + 0.01
End If
        'TurnEntity pPivot, 0.00, 0.00, 0.00
        UpdateWorld
        RenderWorld()
        Flip 0
        'GCCollect()
Wend

Midimaster

now the 3D commands are highlighted and I get into the BlitzMax-HELP with F1.

If I open the help for command Graphics3D I see the behind the keyword "Description" a link to "Online doc". This link goes to...

http://www.blitzbasic.com/b3ddocs/command.php?name=Graphics3D

....but this is of course not online anymore.

So now my question is where to report those bugs? To markcw's gitHub?
...back from Egypt

Amon

Did you build rebuild docs for openb3d or for BlitzMax as a whole? Within Blide I have access to all the docs for OpenB3D.

Midimaster

as I wrote... I have access to the manual, but I found a broken link in it...
...back from Egypt

Derron

#10
Quote from: Amon. on December 01, 2021, 14:42:54
I only added gcCollect because I saw it in an example I think on GitHub. I don't know if it is mandatory if you are cleaning up instead of the GC doing it for you.

If you force the GC to collect you will potentially increase burden for the GC. The GC does stuff when the GC thinks it is time (and necessary).

A long long while ago "GCCollectALittle()" was introduced - if you somehow want to avoid "spikes" during your loops (assume every 100 loops it collects what was created in the previous 99 loops - and of course assuming we talk about some hundred thousand of object creations of some dozen of Megabytes).

So in most cases: leave it out if the modules and app code have no hidden flaws :)



Quote from: Midimaster on December 01, 2021, 13:24:38
2.
CreateCamera() returns a TCamera-Object. When should I use this TCamera when calling it as a TEntiyty also works. f.e. "MoveEntity Camera...".
3.
I still have to use the procedural way of using the entities. Wouldnt it be better to use:
Camera.Move...


You should use "TCamera" if you want to access "TCamera"-specific properties or methods - or want to easily pass it to something only accepting a "TCamera".
That all these Functions accept "TEntity" just adds some convenience and either results in no type-specific things happen in there, or that some casting is done there.

Regarding your "3." - yeah, I would like the less procedural way of doing things there too (but like "setColor" or similar ... there are always exceptions :D).


bye
Ron

markcwm

Quote1. Amon added a "GCCollect" to his example code within the Mainloop. Is this a must? Because without this it runs 10times faster.
Actually, I didn't know the correct usage of GC, thanks to Derron for the answer! I just removed all GCCollect from the examples.

Quote2. CreateCamera() returns a TCamera-Object. When should I use this TCamera when calling it as a TEntiyty also works. f.e. "MoveEntity Camera...".
All extended types can automatically use TEntity, but you do have to cast TEntity up to whatever type you are using.

Quote3. I still have to use the procedural way of using the entities. Wouldnt it be better to use: Cam.Move...
OOP interface is supported, you just remove the first parameter and then it's a method eg. cam.MoveEntity x,y,z MiniB3D also has this.

Global Phobos:TMesh = LoadMesh("data/Phobos.obj")
Global pPivot:TEntity = CreatePivot()
Phobos.SetParent(pPivot)
Phobos.collision_type = 1

One difference about Openb3d, because it's a wrapper every field or global is a pointer so you have to use collision_type[0] to dereference the pointer to set or get the value, but TLists are normal like in MiniB3D. You could use EntityType instead.