Thread: [sdljava-users] UnsatisfiedLinkError Exception Problem
Status: Beta
Brought to you by:
ivan_ganza
From: Chris D. <Des...@nt...> - 2005-06-09 04:59:42
|
Hi, I'm having a bit of a problem with: IntBuffer pixelData = surface.getPixelData().asIntBuffer(); The code is throwing me the following exception. Exception in thread "main" java.lang.UnsatisfiedLinkError: SWIG_getPixelDirectByteBuffer at sdljava.x.swig.SWIG_SDLVideoJNI.SWIG_getPixelDirectByteBuffer(Native Method) at sdljava.x.swig.SWIG_SDLVideo.SWIG_getPixelDirectByteBuffer(SWIG_SDLVideo.java:266) at sdljava.video.SDLSurface.getPixelData(SDLSurface.java:950) at loach.screen.SurfaceTransformer.flipHorizontal(SurfaceTransformer.java:27) at loach.Loach.<init>(Loach.java:102) at loach.Loach.main(Loach.java:177) Picked up _JAVA_OPTIONS: -Dsun.java2d.d3d=true Please help, I'm not sure what is wrong. This code is used in some horizontal image flip transformation code I wrote. public static void flipHorizontal(SDLSurface surface) throws SDLException { surface.lockSurface(); int width = surface.getWidth(), height = surface.getHeight(), pixels = width * height ; IntBuffer pixelData = surface.getPixelData().asIntBuffer(); int[] data = pixelData.array(); int[][] pData = new int[pixels][4]; for (int i = 0; i < pixels; i++) { for (int j = 0; j < 4; j++) { pData[i][j] = data[i * j]; } } int[][][] rData = new int[height][width][4]; for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { rData[row][col] = pData[row * col]; } } int[] temp = new int[width]; for (int row = 0; row < height; row++) { for (int left = 0, right = rData[row].length - 1; left < right; left++, right--) { /* exchange the first and last */ temp = rData[row][left]; rData[row][left] = rData[row][right]; rData[row][right] = temp; } } /* deconstruct this shit and give me a fucking normal int array */ for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { for (int i = 0; i < 4; i++) { data[row * col * i] = rData[row][col][i]; } } } pixelData.clear(); pixelData.put(data); surface.unlockSurface(); } Thanks in advance, Chris -- |> Dessimat0r (Chris Dennett) /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ___.--'~---''--~.__ __.------'''~`-'-, -~--' ~--.__..--~' `~----.__ |
From: Ivan Z. G. <iva...@ya...> - 2005-06-10 02:15:05
|
This is strange. Is the function present in the sdljava.dll? send me your sdljava.dll. Are you compiling from sources? -Ivan/ Chris Dennett wrote: > Hi, I'm having a bit of a problem with: > IntBuffer pixelData = surface.getPixelData().asIntBuffer(); > > The code is throwing me the following exception. > > Exception in thread "main" java.lang.UnsatisfiedLinkError: > SWIG_getPixelDirectByteBuffer > at > sdljava.x.swig.SWIG_SDLVideoJNI.SWIG_getPixelDirectByteBuffer(Native > Method) > at > sdljava.x.swig.SWIG_SDLVideo.SWIG_getPixelDirectByteBuffer(SWIG_SDLVideo.java:266) > > at sdljava.video.SDLSurface.getPixelData(SDLSurface.java:950) > at > loach.screen.SurfaceTransformer.flipHorizontal(SurfaceTransformer.java:27) > > at loach.Loach.<init>(Loach.java:102) > at loach.Loach.main(Loach.java:177) > Picked up _JAVA_OPTIONS: -Dsun.java2d.d3d=true > > Please help, I'm not sure what is wrong. This code is used in some > horizontal image flip transformation code I wrote. > > public static void flipHorizontal(SDLSurface surface) throws > SDLException { > surface.lockSurface(); > int > width = surface.getWidth(), > height = surface.getHeight(), > pixels = width * height > ; > IntBuffer pixelData = surface.getPixelData().asIntBuffer(); > int[] data = pixelData.array(); > int[][] pData = new int[pixels][4]; > for (int i = 0; i < pixels; i++) { > for (int j = 0; j < 4; j++) { > pData[i][j] = data[i * j]; > } > } > int[][][] rData = new int[height][width][4]; > for (int row = 0; row < height; row++) { > for (int col = 0; col < width; col++) { > rData[row][col] = pData[row * col]; > } > } > int[] temp = new int[width]; > for (int row = 0; row < height; row++) { > for (int left = 0, right = rData[row].length - 1; left < > right; left++, right--) { > /* exchange the first and last */ > temp = rData[row][left]; > rData[row][left] = rData[row][right]; > rData[row][right] = temp; > } > } > /* deconstruct this shit and give me a fucking normal int > array */ > for (int row = 0; row < height; row++) { > for (int col = 0; col < width; col++) { > for (int i = 0; i < 4; i++) { > data[row * col * i] = rData[row][col][i]; > } > } > } > pixelData.clear(); > pixelData.put(data); > surface.unlockSurface(); > } > > Thanks in advance, > Chris > |
From: Chris D. <Des...@nt...> - 2005-06-10 04:15:35
|
Sorry, I had outdated versions of the SDLJava dlls, that bit works now. However, I've got problems with the array conversion of the IntBuffer in that code (ByteBuffer -> IntBuffer -> int array). For some reason, the operation doesn't seem to be supported. Is there any other way I can access it? Do you have any examples for doing so? Thanks in advance, Chris Ivan Z. Ganza wrote: > This is strange. Is the function present in the sdljava.dll? send me > your sdljava.dll. Are you compiling from sources? > > -Ivan/ > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you > shotput > a projector? How fast can you ride your desk chair down the office > luge track? > If you want to score the big prize, get to know the little guy. Play > to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users > -- |> Dessimat0r (Chris Dennett) /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ___.--'~---''--~.__ __.------'''~`-'-, -~--' ~--.__..--~' `~----.__ |
From: Ivan Z. G. <iva...@ya...> - 2005-06-11 20:20:19
|
Chris, Sometimes the optional operations are not implemented. If you want to see examples of how the direct buffer stuff is being used have a look in the OpenGL code. If you want to get it into an int[] you should be able to just create your own array and copy the elements into it. Would have been nice had they implemented it though. -Ivan/ Chris Dennett wrote: > Sorry, I had outdated versions of the SDLJava dlls, that bit works > now. However, I've got problems with the array conversion of the > IntBuffer in that code (ByteBuffer -> IntBuffer -> int array). For > some reason, the operation doesn't seem to be supported. Is there any > other way I can access it? Do you have any examples for doing so? > > Thanks in advance, > Chris > > > Ivan Z. Ganza wrote: > >> This is strange. Is the function present in the sdljava.dll? send >> me your sdljava.dll. Are you compiling from sources? >> >> -Ivan/ >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: NEC IT Guy Games. How far can you >> shotput >> a projector? How fast can you ride your desk chair down the office >> luge track? >> If you want to score the big prize, get to know the little guy. Play >> to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 >> _______________________________________________ >> sdljava-users mailing list >> sdl...@li... >> https://lists.sourceforge.net/lists/listinfo/sdljava-users >> > > |