GrabImage Bigger than Resolution Cutoff Issue
BlitzMax Forums/BlitzMax Programming/GrabImage Bigger than Resolution Cutoff Issue
| ||
I'm trying to generate a bigger background image but with max it is always cutoff to the screen resolution. Maybe someone can share or show the equivalent backbuffer of Blit3D/Plug in blitzmax? |
| ||
See the other thread In the end you either use "Render to texture" - or do a software-based-rendering (you create a TPixmap and draw your pixels manually) instead of a hardware-based one. The software variant allows for "RAM" limited images, the GPU one is limited by the GPUs maxTextureSize. bye Ron |
| ||
Thanks Derron, but still not familiar with Blitzmax process. I would just like to replicate Blitz3D's way of doing backbuffer image grabbing. Here's my current code.. bg = CreateImage(imgw,imgh) For y = 1 to maph For x = 1 to mapw DrawRect ... Next Next GrabImage(bg) I think I found some snippet some time ago but forgot to bookmark it. :/ |
| ||
With render to texture you do it similary.SetGraphicsDriver GLMax2DDriver() Local gc:TGraphics = Graphics(800, 600) Local rt:TRenderImage = CreateRenderImage(gc, 800, 600) 'render into that image SetRenderImage(rt) 'clear potential garbage in the image Cls 'draw the stuff as usual DrawRect(0,0, 10,10) DrawOval(100,10, 10,10) ' switch back to render to the original backbuffer SetRenderImage(Null) DrawImage(rt, MouseX(), MouseY()) For more see here. bye Ron |
| ||
Ah thanks! will try this out. That is really a custom solution and I'm actually using gl2sdlmax2d driver, do you think this will still work? |
| ||
You will have to check if col included GLSDL support already. Else you are limited to DX9, DX11 and OpenGL for now. If you only need this to prepare "Non-realtime"-media, you could fall back to software rendering. Of course you need to implement your own "DrawOval", "DrawRect" etc. For bitmap operations by Dig-framework contains some helpers (see base.gfx.sprite.bmx and base.util.imagehelper.bmx). With its bitmap-font-class you could also replace your "DrawText()" things (GetBitmapFont("default", fontsize).Draw(str,x,y)). This class supports (software)rendering to a given bitmap target. bye Ron |
| ||
Mojo2 does some nice things with textures and rendering :-) |
| ||
Thanks. I should consider a non 3rd party mod approach so I can make it more portable. BTW, here's the thread that I think could help. http://www.blitzbasic.com/Community/posts.php?topic=43620 What do you think Derron? |
| ||
Mojo2 does some nice things with textures and rendering :-) Ah thanks Brucey for the heads up! I am looking into porting it to Mojo2, but right now I need to make this work with Max |
| ||
The problem with grabimage/grabpixmap is, that you loose the alpha channel. I did not understand (just quickly scanned the thread) what the thread you linked was about. If you do not need alpha channel, you might as well do multiple grabpixmaps: - split your "big image" in parts so the parts fit onto your screen - loop over all parts: - - render the things for the "part" - - grab image/pixmap - - draw the pixmap "pixel by pixel" (or memory-block-copy) to your "big image pixmap" (this is done in software, so ignores the GPU) - save your big pixmap bye Ron |
| ||
Some progress.. I got this snippet to work with gl2sdl driver/framework using Win32 build http://www.blitzbasic.com/codearcs/codearcs.php?code=2222 but when targetting Android, I'm getting this error.. Identifier 'GL_PROXY_TEXTURE_2D' not found. I guess I have to find another solution that does not use gl commands. |
| ||
GL_PROXY_TEXTURE_2D is not available on GLES2.0 I imagine there are other ways to accomplish the same things. btw, AdjustTexSize() is already included with gl2sdlmax2d. Perhaps you can still use it (unmodified) for GLES? Are you using Max2D because of some legacy code? |
| ||
Ah thanks, yes I figure it out that it is not available. btw, AdjustTexSize() is already included with gl2sdlmax2d. Perhaps you can still use it (unmodified) for GLES? Really not familiar with these commands, I have not seen any examples using them. :/ Are you using Max2D because of some legacy code? I think so. I really want to keep it simple without any of that GL stuff. Maybe if I can get it to port to Mojo2 it will be much easier to do that bigger than screen texture buffer stuff. I just ended up with a simple solution by placing every drawoval/rect in a tile list and draw the grid/tile set every update, since the rendering should be faster and it is not a big tile set I guess it will do for now. Thanks guys |