MiniB3d for FreeBasic

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
Westbeam
Posts: 239
Joined: Dec 22, 2009 9:24
Contact:

Re: MiniB3d for FreeBasic

Post by Westbeam »

Tried it with 0.3 and 0.9, both don't work. :/
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: MiniB3d for FreeBasic

Post by St_W »

I tried to compile the latest version from
https://sourceforge.net/projects/minib3d/
and it worked without big problems. Just a few tweaks were necessary and I got several warnings. I did not test whether the library actually works.

For shared libraries enable position independent code: add "-fPIC" to the CC definition in the makefile.
In the makefile "gcc" is hardcoded two times: add "-fPIC" also there.
That's it.

//edit: here's a simplified+fixed makefile:

Code: Select all

CC=gcc
CPP=g++
CFLAGS=-Wall -O3 -fPIC
CPPFLAGS=-Wall -O3 -fPIC
LDFLAGS=
SOURCES = model.cpp string_helper.cpp surface.cpp bank.cpp bone.cpp brush.cpp collision.cpp entity.cpp functions.cpp geom.cpp global.cpp light.cpp matrix.cpp pick.cpp pivot.cpp project.cpp sprite.cpp tilt.cpp touch.cpp texture_filter.cpp tree.cpp animation.cpp animation_keys.cpp collision2.cpp maths_helper.cpp quaternion.cpp sprite_batch.cpp camera.cpp file.cpp mesh.cpp texture.cpp terrain.cpp stb_image.c 3ds.cpp collidetri.c shadow.cpp material.cpp stencil.cpp csg.cpp voxel.cpp x.cpp octree.cpp geosphere.cpp md2.cpp isosurface.cpp particle.cpp physics.cpp actions.cpp
#SOURCES=$(wildcard *.cpp) $(wildcard *.c)
OBJECTS_TMP=$(SOURCES:.cpp=.o)
OBJECTS=$(OBJECTS_TMP:.c=.o)

all: dylib

dylib: $(OBJECTS) 
ifeq ($(shell uname), Linux)
	$(CPP) $(LDFLAGS) -shared -o libOpenB3D.so $(OBJECTS)  -lGL -lGLU
else
	$(CPP) $(LDFLAGS) -shared -o openb3d.dll $(OBJECTS)  -lGLee -lopengl32 -lglu32 -lGDI32
endif


%.o: %.cpp
	$(CPP) -c $(CPPFLAGS) $< -o $@

%.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@

clean:
	rm -f *.o
	rm -f libOpenB3D.so openb3d.dll
note: take care that the indentations are done with Tabs (not spaces) - it won't work otherwise. Unfortunately the forum software seems to replace the Tabs.
note2: for some reason voxterrain.cpp is not included in the list of sources in the original makefile - I kept that behaviour in the makefile above. If you want to compile just all *.c and *.cpp files into the library uncomment the alternative SOURCES definition in the makefile and remove the first one.
Last edited by St_W on Mar 24, 2016 15:28, edited 3 times in total.
Westbeam
Posts: 239
Joined: Dec 22, 2009 9:24
Contact:

Re: MiniB3d for FreeBasic

Post by Westbeam »

Awesome. It works now. Thank you St_W!
You're my hero :*
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

St_W wrote: note2: for some reason voxterrain.cpp is not included in the list of sources in the original makefile - I kept that behaviour in the makefile above. If you want to compile just all *.c and *.cpp files into the library uncomment the alternative SOURCES definition in the makefile and remove the first one.
voxterrain.cpp can be eliminated, it's not used in the library: the original plan was to build a sort of terrain using LOD marching cubes; at the end, I implemented it inside the isosurface.cpp file, so voxterrain.cpp contains only duplicated, old code.
captmnky
Posts: 2
Joined: Apr 26, 2016 15:24

Re: MiniB3d for FreeBasic

Post by captmnky »

Thank you so much for your current and continued work on this! it is so useful.
captmnky
Posts: 2
Joined: Apr 26, 2016 15:24

Re: MiniB3d for FreeBasic

Post by captmnky »

So I searched for an edit option to no avail. So I'm incredibly sorry for double posting but upon reading through the several pages of post I feel that there was a need for 'offline documentation'.
I'm hoping to help the other noobs who, like me, struggle to make sense of src code when some documentation would go a long way. Also I included an incomplete documentation for OpenB2D also.
This is a rip of each individual page from the blitz3d manual wiki that was then linked together from a single 00.index.html page. I added the OpenB3D commands not found in Blitz3D to the best of my current understanding of them and as time has permitted me. I included tutorial code in a few places mostly ripped straight from these forums. And made a horrible attempt at a badly coded super-basic platform 'engine' demo for OpenB2D just to show some of its commands in practice.
If I get more time and clarifications I may make an update with further documentation also. The one thing I should have done but didn't yet is combine the documentation from the OpenB3D wiki with the Blitz3D manual to fix any specific changes, but the Blitz3D manual is largely compatible as written.

http://www.mediafire.com/download/6bqlq ... manual.zip

p.s. sorry I'm so long winded :)
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

I need some help... the last version I put online is for GLES2, but even if I uploaded it months ago, I received no feedbacks. Has anyone tried compiling it on Android, or on emscripten? I haven't the sdk, and so I can't test.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: MiniB3d for FreeBasic

Post by Tourist Trap »

angros47 wrote:I need some help... the last version I put online is for GLES2, but even if I uploaded it months ago, I received no feedbacks. Has anyone tried compiling it on Android, or on emscripten? I haven't the sdk, and so I can't test.
If you have the exact step by step instructions, I could install the android sdk on a win10 computer. But without the how-to, I can unfortunately be of no help. It's new stuff for me, and the computers I can access are deadly slow so guess and try is just the hell.
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

Unfortunately, I don't know how to install it, otherwise, I would have already tested.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: MiniB3d for FreeBasic

Post by Tourist Trap »

angros47 wrote:Unfortunately, I don't know how to install it, otherwise, I would have already tested.
Ah ok, I've thought it was for the size of the install, about 50 Go I've heard....
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

Update: https://sourceforge.net/projects/minib3d/files/

Emscripten version is now available.

By compiling with "make", it will build the standard library for Windows or Linux (there are only minor tweaks from the version 1.12). It will still use fixed function pipeline by default, to be compatible even with older adapters.

By compiling with "make web" (of course, Emscripten compiler must be installed, and the environment must be configured), it will produce a library that will work in a browser, using GLES2/WebGl, and building automatically a series of shader to emulate the fixed functions used by the standard version (including cubemapping, and multiple lights)
ITomi
Posts: 154
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: MiniB3d for FreeBasic

Post by ITomi »

Function "DrawImage" isn't used in the newest MiniB3d yet?
I would like draw out the player's weapon onto the screen, but when I use "turnentity", this draw is disappears.
Then I try use "drawimage" but it seems MiniB3d doesn't knows it.
Here is the piece of code:

Code: Select all

var weapon=createsprite(camera)
scalesprite weapon,0.5,0.5
entitytexture weapon,weapon1tex
positionentity weapon,entityx#(camera),entityy#(camera),entityz#(camera)+1

Do
        'TurnEntity skydome,0.1,0,0
        
        if multikey(sc_up) then moveentity camera,0,0,0.1
        if multikey(sc_down) then moveentity camera,0,0,-0.1
        if multikey(sc_left) then turnentity camera,0,0.1,0
        if multikey(sc_right) then turnentity camera,0,-0.1,0
        DrawImage weapon,entityx#(camera),entityy#(camera)
        updateworld
        renderworld
        Flip
Loop Until MultiKey(sc_q)
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

Drawimage has never been part of OpenB3D, nor of MiniB3D. It was a 2d command in BlitzBasic, inherited by Blitz3D. And since FreeBasic already has its own 2d command set, there is no point in adding it
ITomi
Posts: 154
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: MiniB3d for FreeBasic

Post by ITomi »

And then how can I use mixed 2d and 3d commands in my program? Is it possible?
I would like draw out a weapon sprite onto the screen during the game, but it works only when I move ahead and backward. Is it solvable with a 2d sprite and 2d commands?
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

OpenB3D provides only 3d commands. Time ago I made a 2d library, too (OpenB2D), but I stopped working on it because too few people were interested. Your sprite issue might depend on the fact that the sprite has to be in front of the camera, to be visible (the camera can't see things that are behind, or on a side, obviously), and in this case you could solve by making the sprite a child of the camera (so, when you turn the camera, you will turn the sprite, too).

To mix 2d and 3d you need to find a way to draw on OpenGL screen (unfortunately, at the moment FreeBasic does not provide this. I already asked the developers to add this feature)
Post Reply