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 / Real Time Screen Effects

Author
Message
Sad Professor
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 17th Jun 2005 20:46
I'm after the quickest method of grabbing a section of the screen and applying some effects to the section (mainly changeing the values of the pixels) and then pasting it back on the screen - I've tried doing this using the 'get image' and turning the image into a sprite so I can use alpha, but this seems incredibly slow to do every frame - and I've been warned off doing this using memblocks - anyone any ideas?

Cheers
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Jun 2005 22:55 Edited at: 17th Jun 2005 22:57
Memblocks is the only solution faster than GET IMAGE. You can actually dump the screen straight to a memblock, and dump it back again afterwards....



That could actually be faster than using GET IMAGE on small sections of the screen.beacuse it uses direct memory manipulation.

You should make the memblock before you get into your main code loop.

BatVink
Sad Professor
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 17th Jun 2005 23:02
But...I have tried this and it proved slow - I posted another topic on this (search: slow memblocks?) and people have told me its slow as I am using main memory as opposed to gpu and its passing from main to gpu which is why its slowing down.....I'm getting a lot of mixed opinions on this.

I'm starting to think that if you use memblocks you pay an initial penalty for the transfer from main memory to gpu, but after that actual calculations on it are faster that get image etc. So if you are going to be using memblocks then make sure that you are making hte most of them (ie a lot of drawing operations) to make them worthwhile because of the performance hit.
Does this make sense?
cheers
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 17th Jun 2005 23:28
If you're using a camera, and not wanting to capture sprites or other images, then use SET CAMERA TO IMAGE. The quickest way then would be through some sort of plugin probably, as there is no low level access to images withDBPro except through memblocks.

More tea Vicar?
Sad Professor
20
Years of Service
User Offline
Joined: 14th Apr 2005
Location:
Posted: 17th Jun 2005 23:32
I'm using it for 2d stuff currenty - is my assumption correct that using memblocks will mean taking a hit during access but realtively speaking operations are faster?

Should I be using memblocks for real time effects?

THanks again
Raven
20
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 18th Jun 2005 00:29
Depends on what R/T Effects your talking about.
Personally I wouldn't waste the processor time with even convering to a memblock.

It's far quicker to use direct memory.





Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 18th Jun 2005 01:35
i knew it!
raven would bring up the backbuffer

but yes writing straight to the buffer is fast(no memory moving)

now if only there was a way to switch buffers like in blitz basic

BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Jun 2005 02:09 Edited at: 18th Jun 2005 02:10
What's the difference speedwise between making memory and making a memblock?

And a second question...can you write words and dwords to memory, like you can with memblocks, or just bytes?

You still have the problem of moving from GPU to memory though, don't you?

BatVink
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Jun 2005 02:24
Quote: "Posted: 7th Sep 2004 17:46

--------------------------------------------------------------------------------
Memblocks are approx 2-3x slower than using Data Pointers.
Memblock creation itself is actually EXTREMELY costly timewise, so try to make sure your memory you use is constant to get better speed rather than constant init/free.

That said they're not exactly sluggish (unless you look at other languages), should be fast enough for most things.
"


BatVink
Raven
20
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 18th Jun 2005 03:01
Data Pointers will shift the data size that you use to move them

e.g.



erm. lol well that didn't work quite right but you get the idea ^_^

Login to post a reply

Server time is: 2025-06-09 05:05:26
Your offset time is: 2025-06-09 05:05:26