Page 1 of 1

Memory to Buffer/VideoMemory

Posted: Fri Sep 12, 2003 4:46 pm
by Dr.Delirium Tremens
This is to aid in the speed up Graphics

You have a bank of memory with image data

Modify some data here and there, modify some more later on.

Great, but we don't want to draw it all pixel by pixel.
Too slow.

If PureBasic had commands to copy and paste, to and from videomemory/buffers/banks whatever, then some cool effects could be had.

Lastly, some commands to do some of the dirty work for transparency on these non video memory areas. Plus any other useful memory manipulation commands (and,xor,not etc...)

I guess what I am getting at is having a way to have pseudo bitplanes that can be copied,combined and manipulated to various degrees.

So, in an example

I got a background in bank 1
I got a forground in bank 2
I got particle effects in bank 3
and maybe several other banks

so....

BEFORE tranfering all this to the display / backbuffer
we first combine and/or copy the various banks and send them to a destination bank and when everything is done, THEN we send this to the video buffer.



CombineBanks [BankSource1,BankSource2,BankDestination,(boolean)]
CopyBank [BankSource1,BankDestination,(boolean)]
FillBank[Bank,<value>]

of coarse some sort of coordinate system or boundry should be implemented
to transfer certain sections

The list could go on.. like increment every number in the bank by N

Lastly, performing 2d operations in banks as if it were video memory, like circle,plot,box etc..

That's it I guess. I was spoiled on the Amiga with all the blitting and stuff. Feel free to ignore this Fred unless it has any merit what-so-ever. I will pray silently to myself. Maybe there are commands to do this and just have not seen them yet.

FYI: I am current Blitz2D and Blitz3d user. I unfortunately could not shell out yet more money on BlitzPlus and then later BlitzMax. I understand people need to make money, but I like to keep some of mine. I possibly made the mistake of purchasing IBasic too, because it had a lot of what Blitz lacked, but THEN I see PureBasic and I feel I wasted both time and money... but I really do love Blitz and I feel for Mark, I really do.

PureBasic appears to have the best of many worlds, so far I am HIGHLY impressed. This will probally be my next purchase, and will gladly pay for major updates if PureBasic is as good as I think it is. (I know updates are free... ::people do need to make money though:: :wink: )

Great Work Fred and Great community. Man, do I feel warm and fuzzy now!

Posted: Fri Sep 12, 2003 4:57 pm
by Paul
Have you looked at the Movie and Sprite commands at all?

Currently you can map a video clip to a sprite and then do anything you want to it effect and graphic wise.

Posted: Fri Sep 12, 2003 5:26 pm
by Dr.Delirium Tremens
Once again, thanks Paul. I will check on this too. I assumed sprites and other "images" were video memory and thus slower to manipulate especially when it came to reading from them.

Oh well,

Like I said, I will research much deeper before spouting out request.

Need some sleep now, cause Warm and Fuzzy has turned into groggy and hazy! :?

Posted: Fri Sep 12, 2003 5:33 pm
by LarsG
If you read the help file on Loadsprite() you'll see that you can choose what memory "type" to put it in... :)
LoadSprite()

Syntax

Result = LoadSprite(#Sprite, FileName$ [, Mode])
Description

Load the specified sprite into memory for immediate use. The sprite can be in BMP (uncompressed form) or any other format supported by the ImagePlugin library. It can have any dimensions and be in either 256 colors, 16 bits, 24 bits or 32 bits. A screen should be opened with OpenScreen() or OpenWindowedScreen() before loading a sprite. If an error occurs the value 0 is returned, otherwise the sprite was loaded successfully. A loaded sprite can be freed by using the FreeSprite() command. The following commands can be used to enable automatically more image formats:

UseJPEGImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()

The 'Mode' parameter is optional and can take the following values:
0 : Default mode. Sprite resides in video memory (if possible)
#PB_Sprite_Memory : Sprite is loaded into main PC memory (for SpecialFX)
#PB_Sprite_Alpha : Sprite is 8 bits grayscale and will be used by DisplayAlphaSprite() or DisplayShadowSprite()
#PB_Sprite_Texture: Sprite is created with 3D support - useful for the CreateSprite3D() command of the Sprite3D library.
*edit* got to learn to type *edit*