Alternative to GrabImage
BlitzMax Forums/BlitzMax Programming/Alternative to GrabImage
| ||
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)? |
| ||
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 ) |
| ||
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. |
| ||
Good call Gfk. :) |
| ||
You will need to create a render buffer using an opengl extension so that you can render-to-texture. |
| ||
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 |
| ||
You could use the Xors3D engine. It has built-in imagebuffers, to which you can draw like you could do in blitz3D. |
| ||
that seems like a horrible lot of clutter to dump in for a single operation (especially considering it should be doable without it) |
| ||
Look in the opengl forum, there is example code posted there freely to create FBO's |
| ||
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 |
| ||
@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 |
| ||
Documentation, what's that? |
| ||
Check out the OpenGL online red/blue book documentation for more info about how FBO's work. |