May 25, 2019, 11:12:01 AM

Author Topic: OpenB3D Questions  (Read 3451 times)

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1828
Re: OpenB3D Questions
« Reply #60 on: February 25, 2019, 12:10:02 AM »
Quote
Good to hear that it works now. Looks like I have to put more effort into the shader QA. Ok, new release date for Faerghail is set to Fall 2059, after my funeral :o
Don't forget to post about it here :P

Quote
I abandoned iMac after they decided to go for Intel+AMD, a bad combination IMHO - either one should use the overexpensive Intel+nVidia combo
I'd of preferred Intel + nVidia too but I am impressed how well the RX580 preforms compared to my earlier iMac which had a pretty naff nVidia GPU ( 740M I think it was ). This is the first iMac that's actually decent at running modern games to any decent frame rate.

Quote
And now as they'll go for ARM in the Macs, Apple is history to me.
I'm not sure about that move as it'll mean the end to dual booting Windows and MacOS which many people do. Also for those who use Windows via Parallels will get screwed too as there is no way you're going to get perfect X86 emulation under ARM at anywhere near native speeds. It'll be a really dumb move if they do replace Intel CPU's with ARM ones.
Until the next time...

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #61 on: February 25, 2019, 06:00:30 AM »
I am impressed how well the RX580 preforms compared to my earlier iMac which had a pretty naff nVidia GPU ( 740M I think it was ). This is the first iMac that's actually decent at running modern games to any decent frame rate.

Yes, even the Late 2013 was a gaming machine, too (with at least High Details in modern games). But the RTX 2080 is a beast and wants Ultra only, so I don't really miss it - like the 16:9 screen (21:9 is more immersive but hard to configure in older games) :P The ARM decision reminds me of Hitchhiker's Guide to the Galaxy:

"The story so far: In the beginning Apple switched to ARM. This has made a lot of people very angry and been widely regarded as a bad move." :P
Kind regards
Krischan

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

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 1773
Re: OpenB3D Questions
« Reply #62 on: February 25, 2019, 09:18:31 AM »
Quote
And now as they'll go for ARM in the Macs, Apple is history to me.

I'm not sure about that move as it'll mean the end to dual booting Windows and MacOS which many people do. Also for those who use Windows via Parallels will get screwed too as there is no way you're going to get perfect X86 emulation under ARM at anywhere near native speeds. It'll be a really dumb move if they do replace Intel CPU's with ARM ones.

"The story so far: In the beginning Apple switched to ARM. This has made a lot of people very angry and been widely regarded as a bad move." :P

That would be a very bad move IMO too.



Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 580
Re: OpenB3D Questions
« Reply #63 on: February 25, 2019, 02:01:03 PM »
@Krischan

..those dungeons looks fantastic..very nice..

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #64 on: March 01, 2019, 03:12:25 PM »
Thanks Naughty Alien, I hope you mean my project, not the LOG video (which looks even more fantastic). :))

Mark, I have another suggestion about an issue which is bugging me since MiniB3D, perhaps you have an elegant solution for this. In TTexture.bmx line 573-589 a check is performed if a texture has been already loaded before and uses the loaded one if yes, like an instance. This is a nice feature to save VRAM but can bring the coder (me!) in trouble when you need to treat the same texture with two different blend modes. So when I'm loading a texture file and set its blend mode to 2 and load the same file again but with a different handle and set its blend mode to 3, the blend mode of the first texture handle becomes 3, too. That is bad.

I've avoided this by just eliminating the whole check in Line 574 with

Code: BlitzMax
  1. Local old_tex:TTexture'=tex.TexInList()

which makes every loaded texture unique, but I'm not happy with this solution as in other cases the check could be useful. Perhaps we can add a flag to the LoadTexture function or create a global function so switch it on/off before loading such a multi-role texture. You know what I mean?

EDIT: or a new function "CopyTexture" to copy an already loaded texture to a different, unique handle which is independant from the original texture.
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: 381
Re: OpenB3D Questions
« Reply #65 on: March 02, 2019, 04:21:16 AM »
Hi Krischan,

yes that's not something that occurred to me before, the simplest way round this is to save the same image with different filenames, but I have a fix uploaded now which uses your ideas, which is a good solution. So you use CopyTexture() and there's an internal global to disable TexInList() when copying, it works in the library as well as BMax.

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #66 on: March 02, 2019, 11:00:42 AM »
Thanks Mark. But there is a new compile error:

Compile Error: Identifier 'glClearDepthf' not found
[c:/Apps/Coding/BlitzMax/mod/openb3dmax.mod/openb3dmax.mod/inc/TGlobal.bmx;268;3]
Build Error: failed to compile c:/Apps/Coding/BlitzMax/mod/openb3dmax.mod/openb3dmax.mod/openb3dmax.bmx

As it fails on a single OpenGL command - do I need to update another module or is it O3D related?

Commenting this line shows a second error (and perhaps there can be more):

Compile Error: Unable to convert from 'Byte Ptr' to 'String'
[c:/Apps/Coding/BlitzMax/mod/openb3dmax.mod/openb3dmax.mod/inc/TTexture.bmx;1006;5]
Build Error: failed to compile c:/Apps/Coding/BlitzMax/mod/openb3dmax.mod/openb3dmax.mod/openb3dmax.bmx

So I can't test it right now.
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: 381
Re: OpenB3D Questions
« Reply #67 on: March 02, 2019, 05:21:22 PM »
Hi Krischan,

sorry, I should have tested it in BRL BMax. It should be fixed now.

glClearDepthf isn't declared in BRL pub.glew (nor in Maxmods glew) but it is declared in NG pub.glew. I copied code from the library where it is declared from GLee.

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #68 on: March 02, 2019, 09:29:20 PM »
Ok, works now - thanks! A question: I wondered if it is possible to have load flags like in LoadTexture in this function, like tex=CopyTexture(tex,1+2+8). If there are no new flags given, the flags of the original texture are used. This makes the function more flexible. Here's my attempt, if you think it is ok you can add it:

functions.bmx
Code: BlitzMax
  1. Rem
  2. bbdoc: Returns a copy of the new texture
  3. End Rem
  4. Function CopyTexture:TTexture( tex:TTexture, flags:Int )
  5.         Return tex.Copy(flags)
  6. End Function

TTexture.bmx
Code: BlitzMax
  1.         Method Copy:TTexture(copyflags:Int=Null)
  2.                
  3.                 Select TGlobal.Texture_Loader
  4.                
  5.                         Case 2 ' library
  6.                                 Local inst:Byte Ptr=TextureCopy_( GetInstance(Self) )
  7.                                 Return CreateObject(inst)
  8.                                
  9.                         Default ' wrapper
  10.                                 Local tex:TTexture=NewTexture()
  11.                                
  12.                                 tex.SetString(tex.file,GetString(file))
  13.                                 tex.SetString(tex.file_abs,FileAbs(GetString(file))) ' returns absolute path of file if relative
  14.                                 tex.blend[0]=blend[0]
  15.                                 tex.coords[0]=coords[0]
  16.                                 tex.u_scale[0]=u_scale[0]
  17.                                 tex.v_scale[0]=v_scale[0]
  18.                                 tex.u_pos[0]=u_pos[0]
  19.                                 tex.v_pos[0]=v_pos[0]
  20.                                 tex.angle[0]=angle[0]
  21.                                
  22.                                 ' added by Krischan to use new flags instead of the original ones
  23.                                 If copyflags then flags[0]=copyflags
  24.                                
  25.                                 TTexture.is_unique=True
  26.                                 If no_frames[0]<2
  27.                                         LoadAnimTextureStream(GetString(file),flags[0],0,0,0,1,tex)
  28.                                 Else
  29.                                         LoadAnimTextureStream(GetString(file),flags[0],width[0],height[0],0,no_frames[0],tex)
  30.                                 EndIf
  31.                                 TTexture.is_unique=False
  32.                                 Return tex
  33.                                
  34.                 EndSelect
  35.                
  36.         End Method
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: 381
Re: OpenB3D Questions
« Reply #69 on: March 03, 2019, 02:10:37 AM »
Hi Krischan,

Great! Okay I can add flags if you think this is needed, there is no command to set flags as such so other than adding a TextureFlags function there is no way to alter flags other than with tex.flags[0].

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #70 on: March 04, 2019, 07:46:46 AM »
Yes, I'd appreciate if you add this in the next update if there's nothing else against it. Sometimes I reuse a texture, for example a texture is loaded with alpha flag (1+2+8) and again without (1+8) and this would save diskspace or I'd need to save the same texture twice with different filenames like you described it to keep the "texture instance" feature.

In Faerghail, I'm using this feature for my loading screen - the loader pic in the middle is the version without alpha and I use the same picture with an alpha flag zoomed in a larger size, blended with another texture as a background filler because a simple wall texture or just a black screen is too boring ;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: 381
Re: OpenB3D Questions
« Reply #71 on: March 06, 2019, 03:57:07 AM »
Hi Krischan,

sure I'll add your fix in to the next commit, I just realized there is a TextureFlags function already in there but certainly no reason not to add it to CopyTexture.

I'm currently struggling a bit with Adam Redwoods awesome batch sprites. I can get it working in Minib3d but Openb3d works a bit different, especially with sprites so I'm just trying to fix that so we can have better single-surface options.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 381
Re: OpenB3D Questions
« Reply #72 on: March 10, 2019, 12:16:49 AM »
Hi Krischan,

CopyTexture(flags) is now in along with batch sprites from minib3d-monkey, this exposed a fix for AddVertex/Triangle which over-resizes arrays to prevent crashes, which is what Minib3d does.

The batch sprite port is in Blitzmax but there's a few issues, first it's not as fast as Minib3d and second there's a render bug which changes the orientation of sprites/meshes at a certain angle, but this is a general bug and nothing to do with batch sprite code. See docs example samples/mak/firepaint3d. There's also an unfinished port to c++ which I may fix later.

Re: your screenies, I can't really follow what you mean but I do think your loading screens are awesome.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 381
Re: OpenB3D Questions
« Reply #73 on: March 13, 2019, 01:16:17 AM »
Hi Krischan,

I've another update which fixes the batch sprites bugs, it seems the "render bug which changes the orientation of sprites/meshes at a certain angle" was actually a bug with the Blitzmax port but that code is replaced with the C++ port which works perfectly and is actually faster than Minib3d, roughly twice as fast, so that's the icing on the cake for me! I didn't expect that, interesting for anyone wondering if C++ is faster than Blitzmax.

Offline Krischan

  • Full Member
  • ***
  • Posts: 197
    • Krischan's Homepage
Re: OpenB3D Questions
« Reply #74 on: March 13, 2019, 10:12:52 PM »
Great, though I haven't used the Batchsprites yet. Oh, and Faerghail still works but I hadn't much time to work on it :-D So what comes next? I'm still unsure how to create a better looking RPG style torchlight shader with shadows to illuminate my levels properly. Perhaps like in this demo video with multiple lights and shadows. The bumpmap.bmx example in OpenB3D is nice to learn the basics but could be better in this point.

Kind regards
Krischan

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