CreateImage / GrabImage trouble in NG
BlitzMax Forums/BlitzMax NG/CreateImage / GrabImage trouble in NG
| ||
Trying to run the following code:SuperStrict Framework brl.Graphics Import brl.glmax2d Import brl.polledinput SetGraphicsDriver GLMax2DDriver() Graphics 1024, 768 Local points:Float[] = [0.0, 0.0, 100.0, 0.0, 100.0, 30.0, 0.0, 30.0] Local i:Int Local minx:Float, miny:Float, maxx:Float, maxy:Float 'calc width and height For i = 0 Until points.length Step 2 If (points[i] < minx) Then minx = points[i] If (points[i] > maxx) Then maxx = points[i] If (points[i + 1] < miny) Then miny = points[i + 1] If (points[i + 1] > maxy) Then maxy = points[i + 1] Next Local collideShape:TImage = CreateImage(maxx - minx, maxy - miny, 1, DYNAMICIMAGE | MASKEDIMAGE) Assert collideShape <> Null DebugLog("create collideImage " + collideShape.width + ", " + collideShape.height) 'draw polygon and grab it into im Cls() SetTransform(0, 1, 1) SetColor(255, 255, 255) SetAlpha(1.0) DrawPoly(points) GrabImage(collideShape, 0, 0) While Not AppTerminate() Cls() SetBlend(ALPHABLEND) SetColor(0, 0, 255) SetAlpha(1.0) DrawImage(collideShape, 400, 300) Flip() Wend EndGraphics() End Using NG bmk 3.10 mt-win32-x86 with gcc 050100 64 bit. If I try to build in x86 mode, it fails with the following: C:\TDM-GCC-64/bin/ld.exe: skipping incompatible C:/.../test/.bmx/test2.bmx.gui.debug.mt.win32.x86.o when searching for C:/.../test/.bmx/test2.bmx.gui.debug.mt.win32.x86.o. It compiles the file successfully just doesn't link. If I try to build in x64 mode, it will compile and link successfully, but: - using SDL's gl driver (gl2max2d) the rectangle does not draw - using SDL's d3d9 driver (d3d9sdlmax2d) the program bombs after linking with "Unhandled Exception: Attempt to access field or method of Null object" highlighting the GrabImage line. - using BRL's gl driver the code builds successfully and displays the rectangle. - using BRL's d3d9 driver bombs with EXCEPTION_ACCESS_VIOLATION and CLS() is highlighted. Thanks in advance for any help you can give me on this. Please let me know if there is any other details you need or if there is anything I can do. |
| ||
That LD error happens when mixing 32 and 64 bit objects, or possibly the wrong formats. I struggled with this very same error for vanilla blitzmax and tdm-gcc-64, and finally gave up and made bmk use gcc to link instead (like open source blitzmax). As i never could figure out which options to make LD do the right thing. Though why you get this for NG i dunno. Tried deleting the .bmx folder and recompile? If not, double check that it uses the correct libraries when linking. bmk makeapp -v -d -g x86 test.bmx bmk makeapp -v -d -g x64 test.bmx |
| ||
I've deleted the .bmx folder and tried to recompile several times, so difference. On the LD error I get one of those, starting with the test.bmx, for every module dependency as well. I ran verbose but I cannot find any discrepancies between 32 and 64 bit (no mixing as described). I also tried running the code in vanilla with both glmax2d and d3d9max2d with success on both. |
| ||
The dx9 stuff appears to be broken at the moment. I'll have a look into it. I've just updated the SDL gl2sdlmax2d module to Flush before trying to read pixels - this should push all the batched commands onto the buffer so there's something to actually read :-) So for now, you should be okay with OpenGL. |
| ||
I would also recommend using Frisky to get a complete bmx-ng package and be sure you have the very latest. In doing so you also get a prepackaged version of mingw specifically for bmx-ng which will eliminate any possible version mismatches. Hopefully ;) |
| ||
@Brucey Yep! GL works like a charm! As for DX, well, its DX! ;) @Grable Thanks for the info on Frisky and NG. I will look into it! |