Ooops
May 30, 2020, 04:01:49 PM

Author Topic: Openb3d (FreeTexture crash)  (Read 10644 times)

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #15 on: June 14, 2017, 08:10:21 AM »
Damn. I used now 0.77 (BlitzMaxNG_win32_Unoffical_0_77.7z), added minib3d and the fixed openb3d from marks repository, applied the changes to the minib3d files and recompiled everything without any errors. MinGW and Path environment settings points to c:\apps\Blitzmax\MinGW32 and c:\apps\Blitzmax\MinGW32\bin, BLIde is happy with MinGW and minib3d compiles and runs my test file without any problems while OpenB3D throws out an Exception at Debug with no further informations.

I've uploaded my whole C:\Apps\Blitzmax folder from this installation try here (178MB ZIP), so please take a look at it and try it yourself if this setup is working or not on your system.
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline GW

  • Full Member
  • ***
  • Posts: 199
Re: Openb3d wrapper (Part 5)
« Reply #16 on: June 14, 2017, 08:31:07 AM »

Are you using bmk to build the modules?
By your description, everything seems ok.
If you're interested, I've zipped up my openb3d.mod folder and you can try replacing yours with mine. everything is already built. Try out the samples in the samples dir and see if they work.
HERE

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #17 on: June 14, 2017, 08:48:08 AM »
I'm using BLIde to rebuild the modules, and BLIde uses BMK afaik. Unfortunately, your MOD folder doesn't work here too but with a different result: it compiles much longer than in my old, working setup and then finally crashes.

Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline GW

  • Full Member
  • ***
  • Posts: 199
Re: Openb3d wrapper (Part 5)
« Reply #18 on: June 14, 2017, 09:13:18 AM »

you need to stop using blide to compile your modules and do it yourself where you have control.
bmk makemods -v -w -g x86 openb3d   {if your using bmaxNG}
or
bmk makemods -a openb3d {if your using bmax OS}


Did you try the examples before you recompiled the mod?


i dont know why there is a dangling 'linepick' in the file
and for some reason GL_TRUE is not defined in pub.opengl. There is nothing else that could prevent a build

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 453
Re: Openb3d wrapper (Part 5)
« Reply #19 on: June 14, 2017, 04:49:18 PM »
Thanks for the bmk tip GW, I think I'll leave the changes to make it easier for others to build.

Does Blide support 64 bit builds with NG? I couldn't find the option. I agree, use the commandline to build modules so you know what's going on.

I only tested openb3d with NG in 32 bit, I should have been building 64 bit.

Offline GW

  • Full Member
  • ***
  • Posts: 199
Re: Openb3d wrapper (Part 5)
« Reply #20 on: June 14, 2017, 09:54:31 PM »
Blide doesn't support 64bit builds because it hides away all the command line args to BMK. Ziggy really need to add that.
I've tweaked bmk give me the option of 64bit builds from blide.  I'm not sure it works correctly.


I'll post a how-to later on how to get blide working with BmaxNG

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #21 on: June 14, 2017, 10:18:34 PM »
Ok I stopped using BLIde to compile modules, promised :-X

I've deleted everything and started from the scratch installing BlitzmaxOS, TDM GCC 5.1, compiled for X86 using the _src/win32_x86/install.bat, copied Mark's fixed openb3d version to the mod folder and compiled both with the commandlines

bmk makemods -a openb3d
bmk makemods -a sidesign



Testing Mark's fixed version:

Result: now BOTH Mods (openb3d and minib3d) compile but the error in my test code still appears, openb3d crashes while minib3d runs through. And Mark, some posts earlier you stated that my test code is running fine on your system, did you run the source several times? In the first run there was no error here and from the second run it started always crashing after a few cycles, even if I delete all compiled files from the .bmx subfolder or change the source to force recompiling. I even used MaxIDE to compile it but it didn't work either.



Testing GW's version:

Your compiled examples work but when I recompile "your" mod it throws out an error, but deleting Line 174 (which is a lonely "LinePick" only which makes no sense there) it compiles, so you should check your source there, too.

Compile Error: Missing function parameter 'x'
[c:/Apps/BlitzMax/mod/openb3d.mod/openb3d.mod/inc/TPick.bmx;174;1]
Build Error: failed to compile c:/Apps/BlitzMax/mod/openb3d.mod/openb3d.mod/openb3d.bmx


Then I compiled the blitz3d/collisions.bmx example - works. And tried again my test source and - *drumroll* - it works! Then I recompiled my current project, which is quite complex, and it still works too, fine :-) Is this your own version? Mark's version has some additions and the shaders are in a separate subfolder as far as I can see. I really appreciate that it's working now with your version but would prefer that we all use the same OpenB3D version and IMHO should stay with Mark's repository or the forks will become too fragmented and it'll be confusing to new users.



So the question is: why is GW's version running and Mark's version doesn't? I tried to compare both version but couldn't find a difference in the FreeTexture Methods, but don't know how the algorithms behind work.

So Mark, could you please
- download my setup (210MB ZIP) and compile my testsource with it and check if the error appears? here it does, always (the folder "openb3d.mod" contains your compiled mod while the "openb3d.mod.gw" folder contains GW's compiled version, both were compiled with this setup)
- if yes, check for possible differences between GW's and your version regarding the FreeTexture algorithms? perhaps there is a bug somewhere?
- I've prepared a testbed (2MB ZIP) where I precompiled the source once with GW's version and once with Mark's version. I only switched the openb3d versions for each compile, the source is the same

And I'm really curious about your results :-D
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 453
Re: Openb3d wrapper (Part 5)
« Reply #22 on: June 14, 2017, 10:42:28 PM »
Okay, thanks Krischan, looks like you've got places. I've been having trouble getting my openb3d branch to run on 64 bit NG, I'm getting a MAV with examples and I can't see what I've done wrong. I'll have a look later on, I'm currently working on a Coor's Light. ;)

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #23 on: June 14, 2017, 11:20:08 PM »
Okay, thanks Krischan, looks like you've got places. I've been having trouble getting my openb3d branch to run on 64 bit NG, I'm getting a MAV with examples and I can't see what I've done wrong. I'll have a look later on, I'm currently working on a Coor's Light. ;)

Ahh ok, it's a beer. Funny, I'm currently working on a Paulaner
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 453
Re: Openb3d wrapper (Part 5)
« Reply #24 on: June 15, 2017, 12:56:46 AM »
Oh, I like a good wiess bier! We don't have Paulaner here but I think Erdinger is the best, not too banana flavoured like so many others. I'll be brewing my own wheat beer soon, first time trying the wheat malt. Last time I made an ale it got a bacterial infection and I had to pour out 2.5 gallons! :(

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #25 on: June 15, 2017, 01:10:11 PM »
Well, I found another problem. This time with GW's version and again with the candles, argh. My parser creates dozens of Sprites for the candles and torches. In GW's version they are all gone, compiling the same source with Mark's version they are still there.

I could isolate the problem to the mesh children - all my light models like candles or torches contain B3D bones titled "flame" or "flame1" to "flame8". I read them and add them to a TCandle or TTorch Type and create sprites at their relative positions to the light mesh. It looks like the Countchildren/Getchild works but the Entityname function returns only cryptic characters and so the algorithm can't decide if a child is a flame or not. Mark's version does it right, I must investigate this further now.

EDIT: I've made a small demo demonstrating the algorithm including the media:
OpenB3Dtest2.zip

Code: BlitzMax
  1. SuperStrict
  2.  
  3. Framework openb3d.B3dglgraphics
  4. Import brl.tgaloader
  5.  
  6. Graphics3D(1024, 768)
  7.  
  8. Global candle:TCandle
  9. Global candlelist:TList = CreateList()
  10.  
  11. Type TCandle
  12.  
  13.         Field ent:TSprite
  14.         Field parent:TEntity
  15.         Field child:TEntity
  16.         Field x:Float
  17.         Field y:Float
  18.         Field z:Float
  19.         Field yaw:Float
  20.         Field scalex:Float
  21.         Field scaley:Float
  22.         Field anim:Float
  23.  
  24. End Type
  25.  
  26. ' load chandelier mesh
  27. Local piv:TPivot = CreatePivot()
  28. Local cam:TCamera = CreateCamera()
  29. Local mesh:TMesh = LoadAnimMesh("chandelier1.b3d", piv)
  30. Local tex:TTexture = LoadAnimTexture("candle.tga", 1 + 2, 32, 64, 1, 64)
  31. PositionEntity mesh, 0, 10, 100
  32. EntityFX mesh, 1
  33.  
  34. ' parse mesh's children
  35. If CountChildren(mesh) Then
  36.  
  37.         For Local c:Int = 1 To CountChildren(mesh)
  38.  
  39.                 If GetChild(mesh, c) Then
  40.  
  41.                         Local child:TEntity = GetChild(mesh, c)
  42.                         Print "Child name: " + EntityName(child)
  43.  
  44.                         ' the child bone has a flame?
  45.                         'If Left(EntityName(child), 5) = "flame" Then
  46.  
  47.                                 candle = New TCandle
  48.  
  49.                                 candle.parent = mesh
  50.                                 candle.child = child
  51.                                 candle.x = EntityX(candle.child)
  52.                                 candle.y = EntityY(candle.child)
  53.                                 candle.z = -EntityZ(candle.child)
  54.                                 candle.yaw = EntityYaw(mesh)
  55.                                 candle.scalex = 3
  56.                                 candle.scaley = 5
  57.                                 candle.anim = Rnd(0, 63)
  58.                                
  59.                                 ListAddLast(candlelist, candle)
  60.  
  61.                         'End If
  62.  
  63.                 EndIf
  64.                
  65.         Next
  66.  
  67. EndIf
  68.  
  69. ' create candle sprites at child's positions
  70. For candle = EachIn candlelist
  71.  
  72.         candle.ent = CreateSprite(candle.parent)
  73.         PositionEntity candle.ent, candle.x, candle.y + candle.scaley, candle.z
  74.         ScaleSprite candle.ent, candle.scalex, candle.scaley
  75.         SpriteViewMode candle.ent, 4
  76.         EntityBlend candle.ent, 3
  77.  
  78. Next
  79.  
  80. MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
  81.  
  82. While Not AppTerminate()
  83.  
  84.         If KeyHit(KEY_ESCAPE) Then End
  85.        
  86.         ' mouse movement
  87.         RotateEntity mesh, 0, MouseX() / 5.0, 0
  88.         PositionEntity piv, 0, -MouseY() / 6.0+64, 0
  89.        
  90.         ' candle Texture Animation
  91.         For candle = EachIn candlelist
  92.        
  93.                 candle.anim:+Rnd(0.125, 0.333)
  94.                 candle.anim = candle.anim Mod 63
  95.                                        
  96.                 If candle.ent Then EntityTexture candle.ent, tex, Int(candle.anim), 0
  97.        
  98.         Next
  99.  
  100.         RenderWorld
  101.        
  102.         Flip
  103.  
  104.         Wend
  105.  
  106. End

I just want to mention that I really appreciate all of your help, that I see a lot of potential in Blitzmax+OpenB3D and I'm confident that we all together can create an official stable and bugfree 1.0 version, preferred in the BlitzmaxNG/64bit variant to make it future-proof.

Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline GW

  • Full Member
  • ***
  • Posts: 199
Re: Openb3d wrapper (Part 5)
« Reply #26 on: June 15, 2017, 06:32:23 PM »
I really don't know how my version is different. I set it up a long time ago and I probably just kept deleting stuff until i stopped getting build errors. Imo, don't rely on the one I sent you build a game, it was just for testing,  use the official version and get that working.   

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 453
Re: Openb3d wrapper (Part 5)
« Reply #27 on: June 16, 2017, 07:35:01 AM »
Quote
i dont know why there is a dangling 'linepick' in the file
and for some reason GL_TRUE is not defined in pub.opengl. There is nothing else that could prevent a build
GW's openb3d version was dated 12 Apr 2016. That Linepick isn't there in TPick.bmx but it may be my bad searching for linepick. In BmxNG Pub.Opengl v1.02 GL_TRUE is defined. Thanks for uploading the zip GW, I was a bit stuck there, I still don't know what's wrong but at least it's working.

Krischan, thanks. I ran your test code several times and it was fine. I tried your Bmx setup and couldn't reproduce the crash but when I tried your testbed it crashed only once and with GW's version. Now I have a new commit which is basically GW's version with a few things reordered. When I ran your code with this it did crash about 3 times in a row but then I couldn't get it to crash again. I'll work on it and see if I can isolate it. You could try going into TSurface.bmx and commenting out FreeVBO from Delete and see what happens.

This commit reverts the library source to the non-GLES 1.12 source, openb3dex.mod is gone and openb3dstd is in, the docs have been split into standard B3d and extended commands to make it clearer, the Text and Graphics commands were moved to b3dglgraphics, type casts from the last commit were taken out so you must use -w overload warnings when building.

Krischan, I tried your candle test and candles in both GW's and mine worked fine and I ran them several times. You should look at TEntity.bmx there's a fix for EntityName EntityClass by DruggedBunny, that may be related to it.

Offline Krischan

  • Full Member
  • ***
  • Posts: 211
    • Krischan's Homepage
Re: Openb3d wrapper (Part 5)
« Reply #28 on: June 16, 2017, 11:51:48 AM »
I applied the fix to TEntity.bmx, Line 662 commented and added this, works now:
Return String.FromCString (EntityString_ (GetInstance(Self),ENTITY_name))

Then I tried again the BlitzmaxNG 0.77 and 0.87 with DruggedBunny's version, recompiled all modules for x86 and x64 from the commandline and ran my Chandelier example - works like expected in x86 and x64. But my testcode with the FreeTexture command still crashes there.

Finally I tried your fixed version from yesterday in my BlitzmaxOS x86 setup. Still crashes and some OpenB3D examples run, some not (but that's because the gfx loaders are missing in the b3dglgraphics.bmx).

Commenting out the FreeVBO command (Line 363) in the TSurface.bmx didn't do anything in all cases. So the most "stable" version to me is now GW's version with the Entityname fix applied. But I know why it isn't crashing: the memory doesn't get freed, so its not usable, too (it starts around 320KB RAM used and the run ends with 320MB! RAM used while the miniB3D run always used max. about 50KB)

So currently none of the available OpenB3D versions can unload textures without an error, what a pity...
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 453
Re: Openb3d wrapper (Part 5)
« Reply #29 on: June 17, 2017, 12:26:21 AM »
Thanks for the tests Krischan, I hope we can sort this bug out. I'll probably remove the TTexture pointers first, to see if it's the wrapper or library.

The TEntity.bmx fixes are in the latest commit, I just added them after I posted my last reply, which seems to be after you downloaded it.

My current version is quite close to DruggedBunny's now, although his readme says it doesn't work with vanilla Bmx getting "load of undefined reference errors" on compiles but I tested a few examples and both versions worked.

Yes, I removed the image loaders from b3dglgraphics without testing. I will put them back in.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal