Alternative to GrabImage

BlitzMax Forums/BlitzMax Programming/Alternative to GrabImage

Pineapple(Posted 2012) [#1]
I need to be able to use DrawSubImageRect such that the target is another image. Is there a way to do this that doesn't include drawing onto the backbuffer (and then using GrabImage)?


Scaremonger(Posted 2012) [#2]
Will this do what you need?

Graphics 800,600
Local jpg:TPixmap = LoadPixmap( "bigimage.jpg" )
Local png:TPixmap = LoadPixmap( "smallimage.png" )

jpg.paste( png, 2,2 )

Repeat
	Cls
	DrawPixmap( jpg, 20,20 )
	Flip
Until KeyHit( KEY_ESCAPE )



GfK(Posted 2012) [#3]
DrawPixmap is slow. Much better to do myImage:TImage = LoadImage(myPixmap), then draw the image.

Of course, this will be slow too if you plan on doing it every frame on a number of images.


Scaremonger(Posted 2012) [#4]
Good call Gfk.

:)


ImaginaryHuman(Posted 2012) [#5]
You will need to create a render buffer using an opengl extension so that you can render-to-texture.


Pineapple(Posted 2012) [#6]
I can't use pixmaps because I need the ability to define a different size for the source and the destination.

how do I create a render buffer?

edit: searching tells me an FBO, but I can find neither examples nor documentation. how do I use it?

Last edited 2012


PowerPC603(Posted 2012) [#7]
You could use the Xors3D engine.
It has built-in imagebuffers, to which you can draw like you could do in blitz3D.


Pineapple(Posted 2012) [#8]
that seems like a horrible lot of clutter to dump in for a single operation (especially considering it should be doable without it)


ImaginaryHuman(Posted 2012) [#9]
Look in the opengl forum, there is example code posted there freely to create FBO's


Oddball(Posted 2012) [#10]
Beanage made a an FBO mod which works great and doesn't add any unnecessary clutter. Check it out.

http://www.blitzbasic.com/Community/posts.php?topic=93479#1069446


Pineapple(Posted 2012) [#11]
@imaginaryhuman

could I maybe have some links, especially to documentations and examples of usage? I'm finding code but I haven't got the first idea how to use it.

@oddball

the download link is broken


ImaginaryHuman(Posted 2012) [#12]
Documentation, what's that?


ImaginaryHuman(Posted 2012) [#13]
Check out the OpenGL online red/blue book documentation for more info about how FBO's work.