V0.45

BlitzMax Forums/MiniB3D Module/V0.45

simonh(Posted 2007) [#1]
Download from here.

All the issues from the beta have been addressed and I've finally caved in and added Max2D support so you don't have to keep adding the appropriate functions yourself.

Note you must be running BlitzMax 1.26 or higher.

PPC Mac users - make sure you are using the updated bmk (see here).


nrasool(Posted 2007) [#2]
Excellent, Well Done Si :-)


Amon(Posted 2007) [#3]
Thank You. :)


Mikele(Posted 2007) [#4]
Thanks Simon!


LarsG(Posted 2007) [#5]
Simon; are you hinting that maybe BMax will be updated to work better with C++?


simonh(Posted 2007) [#6]
No. There's an issue with BMax 1.28 on PPC Macs which prevents it compiling C++ code.


LarsG(Posted 2007) [#7]
oh.. I just tried it, and it worked just fine right out of the box.. :)


simonh(Posted 2007) [#8]
In that case it must only be certain PPC Macs that are affected.


jhocking(Posted 2007) [#9]
Perhaps those Macs don't have XCode installed? If my laptop were working I'd test it for you, but it's in the shop.


ADDITION: Okay so I just tried to update to the latest version and I get errors when I try to compile a program that uses miniB3D. I updated to the latest MingW and tried reinstalling BlitzMax when it wasn't working. I may try reinstalling everything one more time after eating something.

Here is the error output:



ADDITION 2: okay having reinstalled everything now it compiles without error, I just don't see anything being rendered. Note that Max2D graphics are showing up just fine, but I don't see any 3D graphics.

On the off-chance that it'd work with an older version I installed BlitzMax 1.26 this time. I will try reinstalling everything from scratch one more time, using 1.28 this time.


ADDITION 3: yay it works now, that was weird


impixi(Posted 2007) [#10]
Thanks Simon. I'll test the performance on some of my projects that were a little slow when using the older versions of MiniB3d (compared to Blitz3D).


plash(Posted 2007) [#11]
err... is there a list of changes/improvements?

EDIT: also, someone should stick it on the minib3d wiki.


CASO(Posted 2007) [#12]
1.28 is necessary?


jhocking(Posted 2007) [#13]
The main improvements are much faster animation and collision detection.

(by "faster animation" I am of course not referring to the playback speed, but how much of a hit animated characters have on the game's framerate.)


plash(Posted 2007) [#14]
i heard somewhere that v0.45 was gonna have something to do with terrain... confirm?


deps(Posted 2007) [#15]
Thanks for the update!


klepto2(Posted 2007) [#16]
Download added to the Wiki :

MiniB3D Wiki Download

Changelog etc will follow later on.

Excellent work simonH.


CASO(Posted 2007) [#17]
So... there are no octrees anymore? And for some reason with the new version the LoadMesh command returns a "Unhandled Memory Exception Error". Any Ideas?


jhocking(Posted 2007) [#18]
hm true, the CreateOctree command is gone. Is this related to the speedups in collision detection? Like, is this just done automatically now when you call the Collisions command?


Berbank(Posted 2007) [#19]
I get this error. any idea why?

operator '+' can only be used with numeric types

-> polys=polys+leaf_polys


jhocking(Posted 2007) [#20]
Well given that error message, I would assume either "polys" or "leaf_polys" is a variable of some type other than integers or floats.


*(Posted 2007) [#21]
they are TPolygon variables


Barbapapa(Posted 2007) [#22]
Where is MouseYSpeed()?


impixi(Posted 2007) [#23]
Heh, it seems MouseXSpeed() and MouseYSpeed() have been removed from 0.45.

Here they are:

Function MouseXSpeed:Float()
    
    Global oldmx:Float
	
    Local mxs:Float = MouseX() - oldmx
    oldmx = MouseX()
    
    Return mxs

End Function
	
Function MouseYSpeed:Float()

     Global oldmy:Float
		
     Local mys:Float = MouseY() - oldmy
     oldmy = MouseY()

     Return mys

End Function



Just make sure the Globals oldmx and oldmy don't conflict with anything in your own code.


Barbapapa(Posted 2007) [#24]
Any reason for leaving them out? or simply forgotten?


Barbapapa(Posted 2007) [#25]
I compared v042 and 045, even in the examples the Mouse speed commands have been omitted. Now that's strange, because it's deliberately omitted.


simonh(Posted 2007) [#26]
So... there are no octrees anymore?

Yes, there is - see minib3d.bmx. There are octrees, quadtrees and kd-trees - kd-trees are used by default, and are created automatically.

And for some reason with the new version the LoadMesh command returns a "Unhandled Memory Exception Error". Any Ideas?

Send me the b3d file and I'll take a look.

I get this error. any idea why?

operator '+' can only be used with numeric types

-> polys=polys+leaf_polys

You need to update your version of BlitzMax. From 1.26 onwards you can add arrays, which is what's happening here.

Where is MouseYSpeed()? Any reason for leaving them out? or simply forgotten?

They caused problems on Linux, so I decided to leave them out. They shouldn't really be a part of MiniB3D anyway.


*(Posted 2007) [#27]
Memory errors here to with LoadMesh on meshes that used to load into v042 perfectly fine.


CASO(Posted 2007) [#28]
The LoadMesh command works on my personal computer (higher specs). Did the minimum system requirements go up for some reason?


Dreamora(Posted 2007) [#29]
Did you set use vbo to false in minib3d.bmx just to test if your card is just the problem or its capabilities.


siread(Posted 2007) [#30]
How do I stop sprites being clipped? If i use a large sprite it pops into view really late.


siread(Posted 2007) [#31]
I'm still getting scaling issues with animated meshes.

The mesh on the right is a CopyEntity of the left mesh, scaled to 0.5, un-animated. This is fine.



This time the mesh on the right is scaled to 0.5, then animated which causes him to get scaled further.



If I don't scale the copied entity Animate has no effect on it's scale. However, if I scale the master mesh, then copy it, don't scale the copied mesh, then animate the copied mesh, it gets scaled again smaller than the master.


klepto2(Posted 2007) [#32]
@All haveing problems with loading meshes (unhandled memory error) could you please test this :

In TSurface.bmx change the last method called FreeVBO() to this :

Method FreeVBO()
	
		If vbo_id[0]<>0 Then glDeleteBuffersARB(6,vbo_id)
	
	End Method


This should fix the problems.


simonh(Posted 2007) [#33]
EdzUp, can you send me one of the .b3d files that causes the error please?

Si - I'll look into that.


klepto2(Posted 2007) [#34]
simonh, the problem with loading meshes seems to be located in the method I have posted above. If you collapse the animmesh FreeVBO will be called and without checking if a vbo is attached this will result in a unhandled memory exception.

I have tested it today on a not VBO capable machine and my fix seems to fix it.


*(Posted 2007) [#35]
simonh sent the file to ya :)


Barbapapa(Posted 2007) [#36]
What have you done? I just compiled it (included MouseXYspeed before ;) ) and tried it with my project.

And it's FAST!! In 0.42 it took 4-5 seconds to draw 1000 spheres on the hull of another big sphere and now, 1000 even 5000 spheres no problem. WOW!

Cool and thanks


jhocking(Posted 2007) [#37]
Yes, there is - see minib3d.bmx. There are octrees, quadtrees and kd-trees - kd-trees are used by default, and are created automatically.

To clarify, are you still recommending octrees for collision detection? I recall seeing something that indicated always use CreateOctree(mesh:TMesh,max_polys,max_levels) as part of setting up collision detection; is that still true?


klepto2(Posted 2007) [#38]

kd-trees are used by default, and are created automatically.


I think this statement is clearly enough ;)
You don't need to use the Octree anymore, you can use it if you want but kd seems to be faster.

Thats the magic of VBOs
A small summary about VBOs :
Normally without VBOs you have to resend the vertexdata each time the model should be rendered. With VBOs the Vertexdata is stored onto the Gfx card and you only have to send a small int to say which data should be rendered. This saves a lot of bandwith and this is what makes this so fast. Btw: If you would make the spheres single surface instead of having 1000s of single objects your app will running again much faster than now ;)


simonh(Posted 2007) [#39]
Just to clarify klepto's post, VBO's aren't related to kd-trees - the VBO comment was in response to Barbapapa.

Kd-trees are what Blitz3D uses, and yes, they are generally faster than octrees and quadtrees.


Barbapapa(Posted 2007) [#40]

If you would make the spheres single surface instead of having 1000s of single objects your app will running again much faster than now ;)



Unfortunately this is not possible as I have to keep track of every single one. Each sphere will be moving independently and later on even look different.

So cool :)


LAB[au](Posted 2007) [#41]
You can still modify the spheres on the mesh/vertices level, depending on your needs you can specify vertex color or UVW texture maps coordinates. For keeping track of them use a custom type. It's more tricky than having single objects but it's possible and you will feel the speed gain.


simonh(Posted 2007) [#42]
klepto - just had a chance to look, and yes, your suggestion fixes it - thanks.


*(Posted 2007) [#43]
is there something you have to do with the BeginMax2D()..EndMax2D() every time I use it I get the 2d images and no 3d. Even the Max2d example doesnt show the teapot.

Just wondering as I wanted to display 2d ontop of 3d.


slenkar(Posted 2007) [#44]
first time user here,

I downloaded the zip file, opened it, etc. and it compiled OK
but there were a bunch of linking errors.
Do you know what might cause this?


klepto2(Posted 2007) [#45]
What kind of linker errors?
Which BMax Version?
Which minGW Version?


jhocking(Posted 2007) [#46]
If you guys refer to my first post above, I experienced both errors before I reinstalled everything from scratch. That is, I removed BlitzMax from my system, deleted the BlitzMax directory left in Program Files, and removed MingW. Then I downloaded BlitzMax 1.18, updated to 1.28, installed the latest MingW (5.whatever) and finally put miniB3D in my mods folder to compile everything. I don't know what part exactly was causing the problems, but it all worked fine once I reinstalled from scratch.