OpenB3D Questions

Started by Krischan, January 04, 2019, 23:33:07

Previous topic - Next topic

Qube

QuoteGood 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

QuoteI 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.

QuoteAnd 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.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Krischan

#61
Quote from: Qube on February 25, 2019, 00:10:02I 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]
Metaverse | Blitzbasic Archive | My Github projects

Steve Elliott

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.



Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Naughty Alien

@Krischan

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

Krischan

#64
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) Select
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]
Metaverse | Blitzbasic Archive | My Github projects

markcwm

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.

Krischan

#66
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]
Metaverse | Blitzbasic Archive | My Github projects

markcwm

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.

Krischan

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) Select
Rem
bbdoc: Returns a copy of the new texture
End Rem
Function CopyTexture:TTexture( tex:TTexture, flags:Int )
Return tex.Copy(flags)
End Function


TTexture.bmx
Code (blitzmax) Select
Method Copy:TTexture(copyflags:Int=Null)

Select TGlobal.Texture_Loader

Case 2 ' library
Local inst:Byte Ptr=TextureCopy_( GetInstance(Self) )
Return CreateObject(inst)

Default ' wrapper
Local tex:TTexture=NewTexture()

tex.SetString(tex.file,GetString(file))
tex.SetString(tex.file_abs,FileAbs(GetString(file))) ' returns absolute path of file if relative
tex.blend[0]=blend[0]
tex.coords[0]=coords[0]
tex.u_scale[0]=u_scale[0]
tex.v_scale[0]=v_scale[0]
tex.u_pos[0]=u_pos[0]
tex.v_pos[0]=v_pos[0]
tex.angle[0]=angle[0]

' added by Krischan to use new flags instead of the original ones
If copyflags then flags[0]=copyflags

TTexture.is_unique=True
If no_frames[0]<2
LoadAnimTextureStream(GetString(file),flags[0],0,0,0,1,tex)
Else
LoadAnimTextureStream(GetString(file),flags[0],width[0],height[0],0,no_frames[0],tex)
EndIf
TTexture.is_unique=False
Return tex

EndSelect

End Method
Kind regards
Krischan

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

markcwm

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].

Krischan

#70
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]
Metaverse | Blitzbasic Archive | My Github projects

markcwm

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.

markcwm

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.

markcwm

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.

Krischan

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.

https://www.youtube.com/watch?v=7iyvv4mXg6k
Kind regards
Krischan

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