TGLMax2DFBO is 28 Times faster than GrabImage!
BlitzMax Forums/BlitzMax Programming/TGLMax2DFBO is 28 Times faster than GrabImage!
| ||
Hey, since I badly needs it, I decided to try writing a TMax2DGraphics subclass for FBOs. I wasnt quite sure if it would turn out to be too much of a hack, but in the end, it all kinda worked out, and you can use Max2D commands to render *directly* to a TImage with code as simple as: Local myImage:TImage = CreateImage(400, 400) Local myFBO:TGLMax2DFBO = TGLMax2DFBO.ForImage(myImage) myFBO.bind() 'max2d render to texture code here .. myFBO.unbind() 'Standard max2d code here.. Here is a link to the module: http://www.beanage-labs.com/download/beanage.mod.zip IIRC, the kudos for the TFBO class I use go to _JIM! For the heretics, here is a simple demo, performance and functionality test all-in-one. It needs the module to be built: I guess this technology needs some massive testing, so it would be cool if you guys could just mess around with it a little bit, and tell me how it worked out ;} Oh and if you run the test, maybe you could post your results.. I would be interested in how FBOs perform on some other hardware than my GeForce 9800 :) [Edit:] Added some documentation to the mod. Last edited 2011 |
| ||
I keep meaning to add render to texture to Odd2D. Your link times out for me so I couldn't test. Sorry. |
| ||
very interesting but mines times out also. |
| ||
I'm so glad my code is of use to someone :) Also, the whole site seems to be down. |
| ||
Aw, sry, the sever was down the last 8 hours, its back online again now! |
| ||
Interesting. On my PC: In windowed mode, FBO is 16.58 times faster. *unless* I don't move the mouse *at all*, at that point it's 48.4 times faster (for some reason, the standard grabimage test was really slow if the mouse never moves into the window) In full-screen mode, FBO are 17-18 times faster on my PC. Windows 7 x64, ATI Radeon HD4670. Very interesting, though -- are there any expected issues with this method? e.g. may it not be compatible with all video cards, or should this work on any system? |
| ||
I can't get the thing to build. Do I put the mod in a special sub-directory or something to build it? |
| ||
The file structure should read.mod/beanage.mod/fbo.mod/Nice work on this beanage. Any plans on doing a Direct3D7/9 version? |
| ||
Of course it's faster than grab image because grab image copies the backbuffer across the graphics bus from gpu memory to main memory which is really slow and can be just as slow as grabbing a pixmap. glCopySubImage2D() shouldn't be much slower than using an FBO, directly copying the backbuffer into a texture. |
| ||
Thanks Oddball :) Tried for fun to run it on my netbook with gma 950 and got an Exception Access Violation in this line: Local MyImageFBO:TGLMax2DFBO = TGLMax2DFBO.ForImage(MyImage) |
| ||
Any plans on doing a Direct3D7/9 version? Honestly, I have no idea how to approach this in Direct3D.. never used it! glCopySubImage2D() shouldn't be much slower than using an FBO Well, I still think the detour across the backbuffer is kinda unnecessary, isnt it? Of course, unless you run into T-Rek's kind of troubles.. Last edited 2011 |
| ||
Does anyone have a mirror for this module? The original site is up, but the download link no longer works. Does Beanage still post here? |
| ||
Anyone? I'd like to check it out as well. |
| ||
I third this |
| ||
Just use this: http://www.blitzbasic.com/codearcs/codearcs.php?code=2222 |
| ||
Here's a backup: http://www.xlsior.org/temp/beanage.mod.zip |
| ||
Sweet! Many thanks GW and xlsior! I am very grateful for your replies. I'll be looking into them both! |
| ||
Here is a backup 2 http://www.tiberion.eu/download/blitzmax/beanage.mod.zip |
| ||
Someone should really stick a glScissor 0, 0, g_width, g_height at the end of Method _reset() |