Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Memblocks and camera image formats

Author
Message
Kuper
12
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 5th Jan 2020 20:01 Edited at: 6th Jan 2020 14:33
Hello folks!
I try to convert camera image to memblock to read its data.I use camera format A32B32G32R32F (32 bits for the each channel).
And I get that all camera image modes above A8R8G8B8 format doesn't work with memblocks.
Memblock is created empty with no color data in it.And more: you can't load 128bit .dds image and create memblock from it - it is also empty.
And final: you can't save image which is more then 32bit.Image will be converted automatically to A8R8G8B8 format.Tested with .bmp and .dds files.
So, this is problem: you can't get any info from any image, which is more then 32bit (8bit per chanel).

Is it old well known bug or I did something wrong?
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 11th Mar 2020 03:28
I am replying 3 months later. I wonder if you will read this.

As far as I am aware the limit is 32bit images. I have some experience using these since in the past I have posted methods for layering textures into a single texture (to give characters different clothes,etc) and for taking transparent screenshots by comparing the same scene against white and black backgrounds.
It's been a while since I looked at code, I remember encountering ABGR format somewhere, possibly with the actual Memblocks.

Dark Basic Professional is a 2002 product with a few 2005 updates. HDR is really something that came after 2006.

Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!
Kuper
12
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 15th Mar 2020 19:37
Thanks for respond, Mage
You can convert camera image to membock only with DBProEx. And only 8-bit per chanel. I think it is okay - I just compress 1 float to RGBA 8-bit. It works fine.
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 16th Mar 2020 22:17
There is an exception.
With DBPro you can copy the image to a new image number and the memblock conversion will proceed without error.


When you attempt to do this with DBPro, you end up with an image lock error.
So you can paste the image to screen, and then Get Image to convert the image to a new separate image number (which isn't locked by camera drawing).
This then means that the image has been copied to a new image number and conversion to Memblock will succeed. The downside is that you had to paste the image to screen.
So if you switch from Bitmap 0 to Bitmap 1, before this process and switch back to Bitmap 0 after, you will not see the image pasted to screen and you will achieve the same effect.
You take some performance hit doing this. However this is a solution to converting a camera image to memblock.


Reference:
https://forum.thegamecreators.com/thread/184514
This is the Transparent Screenshot method I mentioned. The code could use some cleaning up. Instead of swapping bitmaps to hide the effect, it just copies the existing screen and pastes it over the image to hide it. However it demonstrates copying image contents into a separate image number to allow the memblock conversion process.





Mage's Modular Code - Get awesome UI controls and powerful Bitmap Fonts!
Screen Device Recovery - Stop your apps from crashing when minimized/tabbed/screen locked.
CPU Friendly Frame Limiter - Make your app generate less computer heat + noise, and use less battery life!
Raven
15
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th Mar 2020 16:45
While Dark BASIC Professional does support all DirectX 9 Pixel Formats (as do the Memblocks), the Image Loader was never designed to support anything other than 32-bit Per Pixel Formats.
Now something to keep in mind is that "Bitmaps" are actually Render Targets / Buffers... so whatever their format is, is whatever the output format is.

This isn't however going to change the Device Context (Device Back Buffer) Pixel Format., and at present I forget how to do this... I do remember it being quite difficult.
You might have more luck with the DirectX9Ex and DirectX11 replacement Libraries.

Login to post a reply

Server time is: 2020-04-06 19:43:17
Your offset time is: 2020-04-06 19:43:17