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 / How to set camera to image and use memblock. for that image

Author
Message
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 8th Oct 2012 02:47
Hi I noticed a problem when you for example when you make camera, render what it sees to a image and make a memblock from that image.
I get the error message "Cannot read an image currently lock by the system." I even tried locking the pixels but that did help.

If you don't understand here is the code run it:


Does anyone know how to fix this?

darkvee
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 8th Oct 2012 04:40 Edited at: 8th Oct 2012 05:05
I have submitted this as one of the "Top 3 Bugs To Be Fixed" when they did a call out to the community for requests several months ago.

http://forum.thegamecreators.com/?m=forum_view&b=1&t=193289&p=0

It was chosen, and is currently listed as #16 on the list.


Workaround:
I have a workaround that might not work for everyone.

1. Consider the "locked" image to be "Image A".

2. Copy an area of screen the exact dimensions of "Image A" to a new image, "Image B".

3. Paste "Image A" to this space on the screen.

4. Copy what you just pasted to a new image, "Image C".

5. Paste "Image B" back in place to cover up any on screen evidence.

You now have "Image C" unlocked with "Image A" contents. Basically you copy the contents of your image to a new separate image by way of pasting/screen grabbing and covering up the mess.

You might ask why not simply copy "Image A" to "Image C"?
Most if not all methods and plugins crash or fail due to the image being locked.

Covering up the on-screen effect is 99.9999% effective. If the screen contents are rapidly changing on that single frame following this technique the coverup might not line up with screen contents. This would never be visible with a typical game even at low frame rate.

If anyone has a more efficient method, I would be happy to hear it. I wouldn't be surprised if one existed.

Further:
I don't know what it is you are trying to ultimately do, but you might be able to use Image Kit v2 in some way to achieve your ultimate goal I suspect. Image Kit will still have this problem and a direct approach will not work. I was able to use Image kit to get around this problem when it was combined with a custom shader.

Reference:
http://forum.thegamecreators.com/?m=forum_view&t=184514&b=1

Virtual Nomad
Moderator
20
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 8th Oct 2012 06:43 Edited at: 8th Oct 2012 06:58
pasting the camera's image to another bitmap and then make memblock from bitmap should be a quicker workaround?

add:
Quote: "should be a quicker workaround"

ewww. results not what i expected... :/

Virtual Nomad @ California, USA . DBPro V7.7
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit

Login to post a reply

Server time is: 2026-07-09 02:34:31
Your offset time is: 2026-07-09 02:34:31