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
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

MiniB3d for FreeBasic

Post by angros47 »

This is MiniB3D for FreeBasic:

http://sourceforge.net/projects/minib3d/

Windows and Linux version.

Previous version is:

http://www.file-pasta.com/file/0/miniB3 ... r%20FB.zip
(Windows)

http://www.file-pasta.com/file/0/MiniB3 ... nux.tar.gz
(Linux)

(first version at http://www.file-pasta.com/file/0/minib3 ... ebasic.zip)

I took iMiniB3D (that was written in C++ and ObjC), ported it to C++, compiled to a DLL with MingW, and made a simple .bi file.

I've made some changes from original miniB3D:

-this version uses quaternions internally (thanks to warner): so, no more gimbal lock.
-this version uses stb_image.c to load textures: no more OS-specific depandancies.

It supports also terrains, and 3ds files.
Last edited by angros47 on Oct 16, 2010 18:05, edited 3 times in total.
D.J.Peters
Posts: 8588
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

nice looks simple

Joshy
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Post by duke4e »

Awesome work and simple to use!

Here's an updated example:
(note that this is my first contact with minib3d)

Code: Select all

#include "minib3d.bi"
#include "fbgfx.bi"
Using FB

Const xres = 1024
Const yres = 768
Screenres  xres, yres, 32,, GFX_OPENGL
Graphics3d xres, yres, 32, 1, 1


Var camera=createcamera(0)
CameraViewport(camera,0,0,xres,yres)
Var bird=LoadAnimMesh ("bird.b3d",0)
moveentity bird,0,0,15

animate bird,1,.1,0,0

AmbientLight(0, 255, 255)
Do
    EntityAlpha bird, Abs(Cos(Timer))
    
    If Multikey(SC_W) Then turnentity bird, -1,  0,  0, 0
    If Multikey(SC_S) Then turnentity bird,  1,  0,  0, 0
    If Multikey(SC_A) Then turnentity bird,  0, -1,  0, 0
    If Multikey(SC_D) Then turnentity bird,  0,  1,  0, 0
    If Multikey(SC_Q) Then turnentity bird,  0,  0, -1, 0
    If Multikey(SC_E) Then turnentity bird,  0,  0,  1, 0
    
    If Multikey(SC_RIGHT) Then TranslateEntity bird,  1,  0, 0, 0
    If Multikey(SC_LEFT)  Then TranslateEntity bird, -1,  0, 0, 0
    If Multikey(SC_DOWN)  Then TranslateEntity bird,  0, -1, 0, 0
    If Multikey(SC_UP)    Then TranslateEntity bird,  0,  1, 0, 0
	updateworld 1
	renderworld
    
	Flip
Loop Until Multikey(SC_ESCAPE)
joseywales72
Posts: 206
Joined: Aug 27, 2005 2:02
Location: Istanbul, Turkey

Post by joseywales72 »

Very very nice and easy. Thank you.

I tried the executables on Linux with Wine, and they both work flawlessly.
I also tried to compile the source, but no use. It gives;

Code: Select all

surface.cpp:10:21: error: gl\GLee.h: No such file or directory
and stops.
I try a simple make command though. I'll try it with headers from Mingw later.

Great job again.
Anil
Last edited by joseywales72 on Apr 20, 2010 9:48, edited 1 time in total.
Prime Productions
Posts: 147
Joined: May 24, 2009 23:13
Location: Texas, United States, Planet Earth
Contact:

Post by Prime Productions »

Great job. I've been waiting for this. Now FB has Blitz 3D capabilites and more.

David
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

I have sometimes tested with SDL and a Screen of FB-Basic with ScreenRes 200,200,32.
On the ScreenRes is with PSet (numberx,numbery), RGB (255,0,0).

Wonderful, 2 Screens with Opengl and Minib3d.

Code: Select all

 #Include "minib3d.bi"
	#Include "SDL/SDL.bi"
	#Include "fbgfx.bi"
	#Include "windows.bi"
	#Include "crt.bi"
	USING FB

	Const SCR_WIDTH = 500
	Const SCR_HEIGHT = 500
	Const BPP = 16

	Dim vpage as SDL_Surface Ptr
	Dim event as SDL_Event
   Dim As Integer result,camera,bird,zahlx,zahly
  
	result = SDL_Init(SDL_INIT_EVERYTHING)
	if result <> 0 then
  		end 1
	end If
	
   ScreenRes 200,200,32
	ScreenControl SET_WINDOW_POS, 10,10
	
	vpage = SDL_SetVideoMode(SCR_WIDTH, SCR_HEIGHT, BPP, SDL_OPENGL or SDL_OPENGLBLIT)
	if vpage = 0 Then
		SDL_Quit
		end 1
	end If
	SDL_WM_SetCaption "test", ""

	Graphics3d SCR_WIDTH, SCR_HEIGHT,32,1,1

	camera=createcamera(0)
	CameraViewport(camera,0,0,500,500)
	bird=LoadAnimMesh ("bird.b3d",0)
	moveentity bird,0,0,15

	animate bird,1,.1,0,0

Do	
	Sleep 5
	
   If multikey( FB.SC_q ) Then   
    	turnentity bird,1,0,0,0
   End If  
   If multikey( FB.SC_w ) Then   
    	turnentity bird,-1,0,0,0
   End If 
   If multikey( FB.SC_e ) Then   
    	turnentity bird,0,-1,0,0
   End If 
   If multikey( FB.SC_s ) Then   
    	turnentity bird,0,1,0,0
   End If 
   
   zahlx=INT(RND * 199) + 1
   zahly=INT(RND * 199) + 1
   PSet(zahlx,zahly),RGB(255,0,0)
   
   updateworld 1
	renderworld
	SDL_GL_SwapBuffers

	SDL_PumpEvents
loop until( (SDL_PollEvent( @event ) <> 0) and (event.type = SDL_MOUSEBUTTONDOWN)) 


super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

Extended version of MiniB3D for Freebasic !!!???

With Terrain.....!!!???

Gruss
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

Post by angros47 »

The current version doesn't support terrains; the next version will (I already have the BlitzMax source, but I need to translate it in C++)
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

hello, thanks you for the help.

Gruss
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

you can read "x" or "3ds" mesh with minib3d ?

gruss
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

Post by angros47 »

Not yet, sorry.

There is a modded version of MiniB3d (only for BlitzMax) that supports terrains, quaternions, and 3DS: http://www.hi-toro.com/blitz/sidesign.zip

I'm porting it in C++: I've already ported quaternions, and now I'm working on terrains; after that, I'll give a look at 3ds loader.

Of course, if someone wants to help, I'll appreciate it.
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

Post by angros47 »

I'm getting closer to have working terrains; in C++, they works!
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

that's wonderful.

gruss
angros47
Posts: 2331
Joined: Jun 21, 2005 19:04

Post by angros47 »

Finally, a new version!

This one supports LOD terrains. You can use an heightmap, or manually draw/modify the terrain with ModifyTerrain.

Demo included.

Download it at:
http://www.file-pasta.com/file/0/Minib3 ... r%20FB.zip
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Post by super_castle »

he, thanks for the new version !

gruss
peter
Post Reply