GrabImage help

BlitzMax Forums/BlitzMax Beginners Area/GrabImage help

big10p(Posted 2008) [#1]
I'm trying to simply draw something on the backbuffer and then copy it to an image but it's not working. It's almost as though GrabImage isn't working as I can confirm the image is being drawn on the back buffer by uncommenting the line near the bottom of the function code.



Also, any idea why this version crashes, causing me to have to reboot?



GfK(Posted 2008) [#2]
In the first one, its actually working perfectly except you've got the color set as 0,0,0. Set it back to 255,255,255 after calling create_target_image().

For future reference, SetColor effects the color of everything you draw - images included.

In the second example, you're trying to draw an image that doesn't exist. If you run that in release mode (non-debug) its probably not gonna like it. When I run it with Debug enabled, it tells me that targ_image is a null object (it doesn't exist).


big10p(Posted 2008) [#3]
In the first one, its actually working perfectly except you've got the color set as 0,0,0. Set it back to 255,255,255 after calling create_target_image().

For future reference, SetColor effects the color of everything you draw - images included.
Ah yes, that works, thanks. I did actually read about this but completely forgot about it. :/

In the second example, you're trying to draw an image that doesn't exist. If you run that in release mode (non-debug) its probably not gonna like it. When I run it with Debug enabled, it tells me that targ_image is a null object (it doesn't exist).
Why doesn't the image exist? targ_image is a global so should be assigned the image inside the function, no? Also, I'm using the demo version of bmax which just seems to produce debug builds. I don't get any error message. Strangely though, if I put a DebugStop in the working version, it crashes again and I have to reboot. :/

I also notice that the output window sometimes displays this info at the end. Is this normal? I have no idea what it means.

GetModuleHandleA succeed

LoadLibrary returns baaa0000

Process complete




GfK(Posted 2008) [#4]
Why doesn't the image exist?
Well, you've commented out the function call!

Global targ_image:tImage Only says "I want targ_image to be a tImage". Even after you've made the definition, targ_image is still Null - that is, not an object, not zero, but Null. Nothing.

To attach an object, you must use LoadImage, CreateImage, or LoadAnimImage.

Not sure about the other stuff relating to the Blitzmax demo, but rest assured I'm not getting any of that nonsense in Blitzmax 1.30 full version.


big10p(Posted 2008) [#5]
Well, you've commented out the function call!
lol. I'm a bit rusty at this coding lark but that one's a classic. :p I meant to move the call to a separate line but for some reason I commented it out!

Any idea about the debug strangeness? Like I said, that numpty version didn't throw an error, it just crashed. :/


GfK(Posted 2008) [#6]
Nope, no strangeness here. Must be demo-related.


big10p(Posted 2008) [#7]
Possibly, or maybe some strangeness related to my PC. I just don't want to buy blitzmax and find the debugger still doesnt work. :S

Thanks for the help.