Thread: [sdljava-users] Problem with sdl_gfx -> aaPolygonRGBA
Status: Beta
Brought to you by:
ivan_ganza
From: Goliat S. <gol...@un...> - 2005-02-17 22:51:17
|
First hello to the list :) i've played around with sdljava for some time and now i have a little problem ... the method aaPolygonRGBA in SDLGfx seems to be broken somehow by using this (sample) call to the method: short[] sx = { 10, 10, 105, 10 }; short[] sy = { 5, 7, 100, 5 }; SDLGfx.aapolygonRGBA( surface , sx, sy, (short)255, (short)255, (short)255, (short)255 ); i get my gamescreen but no drawn polygon and after a while some lines which cover the whole surface appear, additionally they seem to appear spontaniously after some frames more or less everytime i restart the whole thing unfortunatly i just tried to do a screenshot of the lines ... but they didn't appear at all ... neither the polygon was drawn i'm using sdljava-0.9.0 and the sun jdk 5.0 running on a gentoo system with a current 2.6.10 kernel (with those thousand gentoo patches) greetz Goliat |
From: Ivan Z. G. <iva...@ya...> - 2005-02-18 02:55:17
|
Greetings Goliat. Welcome to the list. Thanks for finding this. I've been able to reproduce it and something is defiantly wrong here. I'm not quite sure why it happends. I've just realized that all this SDLGfx code needs to be changed to transfer the co-ordinates via NIO Direct Buffers -- so I've tried a quick change to this method with an NIO buffer, and this seems to be working properly. I'm going to change all the methods to use this method instead of java arrays. This will also allow it to be MUCH faster as no copy has to occur between java and C -- also the possibility exists to reuse already created ByteBuffers.... For example the method now looks like this: public static int polygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a) I would like to get this in with the release. I'm going to check in the above change incase you want to try that one method and your on CVS. If you have a chance let me know if it works for you. -Ivan/ Goliat Skipson wrote: > First hello to the list :) > > i've played around with sdljava for some time and now i have a little > problem ... > the method aaPolygonRGBA in SDLGfx seems to be broken somehow > > by using this (sample) call to the method: > > short[] sx = { 10, 10, 105, 10 }; > short[] sy = { 5, 7, 100, 5 }; > SDLGfx.aapolygonRGBA( surface , sx, sy, (short)255, (short)255, > (short)255, (short)255 ); > > i get my gamescreen but no drawn polygon and after a while some lines > which cover the whole surface appear, additionally they seem to appear > spontaniously after some frames more or less everytime i restart the > whole thing > > unfortunatly i just tried to do a screenshot of the lines ... but they > didn't appear at all ... neither the polygon was drawn > > i'm using sdljava-0.9.0 and the sun jdk 5.0 running on a gentoo system > with a current 2.6.10 kernel (with those thousand gentoo patches) > > greetz Goliat > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |
From: <gol...@un...> - 2005-02-18 15:16:00
|
Thanks for responding so quick :) If i find some free time today i'll try to compile from cvs (which i tried before but never succeded) Goliat PS: if this is a html mail ... sry ;) (trying to get kmail working) |
From: Ivan Z. G. <iva...@ya...> - 2005-02-19 02:07:12
|
I've checked in code which effectively changes all short[] arguments to ShortBuffers(s) instead. There is a problem however and I'm not sure what it is. Running test-aaploygonRGBA.bsh results in the following out -- although I am passing sane values when the ShortBuffer is read on the C side the values are all messed up. This is strange because I'm using the same idea with the OpenGL layer and all seems to work fine. I'm not access the buffers myself on the OpenGL though, OpenGL is, yet it works fine in that case. If any has a clue please let me know....The code looks like this: void* vx and void* vy are pointers obtained via getDirectByteBufferAddress()... int SWIG_aapolygonRGBA(SDL_Surface *dst, void* vx, void* vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { int i; for (i = 0; i < n; i++) { Sint16* svx = (Sint16*)vx; Sint16* svy = (Sint16*)vy; printf("n=%i, vx=%i, vy=%i\n", i, svx[i], svy[i]); } return aapolygonRGBA(dst, (Sint16*)vx, (Sint16*)vy, n, r, g, b, a); } n=0, vx=28928, vy=29288 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=28928 n=0, vx=31440, vy=31800 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=31440 n=0, vx=-31552, vy=-31192 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-31552 n=0, vx=-29040, vy=-28680 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-29040 n=0, vx=-26528, vy=-26168 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-26528 n=0, vx=-24000, vy=-23640 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-24000 n=0, vx=-21488, vy=-21128 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-21488 n=0, vx=-18976, vy=-18616 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-18976 n=0, vx=-16464, vy=-16104 n=1, vx=17819, vy=17819 n=2, vx=-28704, vy=-16464 gol...@un... wrote: >Thanks for responding so quick :) > >If i find some free time today i'll try to compile from cvs (which i tried >before but never succeded) > >Goliat > >PS: if this is a html mail ... sry ;) (trying to get kmail working) > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >_______________________________________________ >sdljava-users mailing list >sdl...@li... >https://lists.sourceforge.net/lists/listinfo/sdljava-users > > |
From: Robert S. <the...@gm...> - 2005-02-19 07:07:01
|
Hi. I have not seen how you create and fill the ShortBuffer but it could be a problem with endianness/byte-order (or byte sex :) ). ByteBuffer.allocateDirect(2*NUM_OF_SHORTS).byteOrder(ByteOrder.nativeOrder()).asShortBuffer() should do the trick cu Robert Ivan Z. Ganza wrote: > I've checked in code which effectively changes all short[] arguments > to ShortBuffers(s) instead. > > There is a problem however and I'm not sure what it is. Running > test-aaploygonRGBA.bsh results in the following out -- although I am > passing sane values when the ShortBuffer is read on the C side the > values are all messed up. This is strange because I'm using the same > idea with the OpenGL layer and all seems to work fine. I'm not access > the buffers myself on the OpenGL though, OpenGL is, yet it works fine > in that case. If any has a clue please let me know....The code looks > like this: void* vx and void* vy are pointers obtained via > getDirectByteBufferAddress()... > > int SWIG_aapolygonRGBA(SDL_Surface *dst, void* vx, void* vy, int n, > Uint8 r, Uint8 g, Uint8 b, Uint8 a) { > > int i; > > for (i = 0; i < n; i++) { > Sint16* svx = (Sint16*)vx; > Sint16* svy = (Sint16*)vy; > printf("n=%i, vx=%i, vy=%i\n", i, svx[i], svy[i]); > } > return aapolygonRGBA(dst, (Sint16*)vx, (Sint16*)vy, n, r, g, b, a); > } > > > n=0, vx=28928, vy=29288 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=28928 > n=0, vx=31440, vy=31800 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=31440 > n=0, vx=-31552, vy=-31192 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-31552 > n=0, vx=-29040, vy=-28680 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-29040 > n=0, vx=-26528, vy=-26168 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-26528 > n=0, vx=-24000, vy=-23640 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-24000 > n=0, vx=-21488, vy=-21128 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-21488 > n=0, vx=-18976, vy=-18616 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-18976 > n=0, vx=-16464, vy=-16104 > n=1, vx=17819, vy=17819 > n=2, vx=-28704, vy=-16464 > > > gol...@un... wrote: > >> Thanks for responding so quick :) >> >> If i find some free time today i'll try to compile from cvs (which i >> tried before but never succeded) >> >> Goliat >> >> PS: if this is a html mail ... sry ;) (trying to get kmail working) >> >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> sdljava-users mailing list >> sdl...@li... >> https://lists.sourceforge.net/lists/listinfo/sdljava-users >> >> > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users > > |
From: Bart L. <bar...@ya...> - 2005-02-19 11:27:29
|
Hi, Give a look on sdljava.util.BufferUtil class on CVS, which have methods to create direct native type buffers. CUS, /Bart. --- Robert Schuster <the...@gm...> a écrit : > Hi. > I have not seen how you create and fill the > ShortBuffer but it could be > a problem with endianness/byte-order (or byte sex :) > ). > > ByteBuffer.allocateDirect(2*NUM_OF_SHORTS).byteOrder(ByteOrder.nativeOrder()).asShortBuffer() > > should do the trick > > cu > Robert > > Ivan Z. Ganza wrote: > > > I've checked in code which effectively changes all > short[] arguments > > to ShortBuffers(s) instead. > > > > There is a problem however and I'm not sure what > it is. Running > > test-aaploygonRGBA.bsh results in the following > out -- although I am > > passing sane values when the ShortBuffer is read > on the C side the > > values are all messed up. This is strange because > I'm using the same > > idea with the OpenGL layer and all seems to work > fine. I'm not access > > the buffers myself on the OpenGL though, OpenGL > is, yet it works fine > > in that case. If any has a clue please let me > know....The code looks > > like this: void* vx and void* vy are pointers > obtained via > > getDirectByteBufferAddress()... > > > > int SWIG_aapolygonRGBA(SDL_Surface *dst, void* vx, > void* vy, int n, > > Uint8 r, Uint8 g, Uint8 b, Uint8 a) { > > > > int i; > > > > for (i = 0; i < n; i++) { > > Sint16* svx = (Sint16*)vx; > > Sint16* svy = (Sint16*)vy; > > printf("n=%i, vx=%i, vy=%i\n", i, svx[i], > svy[i]); > > } > > return aapolygonRGBA(dst, (Sint16*)vx, > (Sint16*)vy, n, r, g, b, a); > > } > > > > > > n=0, vx=28928, vy=29288 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=28928 > > n=0, vx=31440, vy=31800 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=31440 > > n=0, vx=-31552, vy=-31192 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-31552 > > n=0, vx=-29040, vy=-28680 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-29040 > > n=0, vx=-26528, vy=-26168 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-26528 > > n=0, vx=-24000, vy=-23640 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-24000 > > n=0, vx=-21488, vy=-21128 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-21488 > > n=0, vx=-18976, vy=-18616 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-18976 > > n=0, vx=-16464, vy=-16104 > > n=1, vx=17819, vy=17819 > > n=2, vx=-28704, vy=-16464 > > > > > > gol...@un... wrote: > > > >> Thanks for responding so quick :) > >> > >> If i find some free time today i'll try to > compile from cvs (which i > >> tried before but never succeded) > >> > >> Goliat > >> > >> PS: if this is a html mail ... sry ;) (trying to > get kmail working) > >> > >> > >> > ------------------------------------------------------- > >> SF email is sponsored by - The IT Product Guide > >> Read honest & candid reviews on hundreds of IT > Products from real users. > >> Discover which products truly live up to the > hype. Start reading now. > >> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > >> _______________________________________________ > >> sdljava-users mailing list > >> sdl...@li... > >> > https://lists.sourceforge.net/lists/listinfo/sdljava-users > >> > >> > > > > > > > > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT > Products from real users. > > Discover which products truly live up to the hype. > Start reading now. > > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > > _______________________________________________ > > sdljava-users mailing list > > sdl...@li... > > > https://lists.sourceforge.net/lists/listinfo/sdljava-users > > > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT > Products from real users. > Discover which products truly live up to the hype. > Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users > Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ |
From: Ivan Z. G. <iva...@ya...> - 2005-03-01 23:28:37
|
I've finally tracked down the cause of this bug and fixed it! You can now pass ShortBuffers into all the functions which took short* as a long of co-ordinates and it will work properly. The problem was in my SWIG typemap... Please let me know if this works for you now. I have tested here and all is working. -Ivan/ Goliat Skipson wrote: > First hello to the list :) > > i've played around with sdljava for some time and now i have a little > problem ... > the method aaPolygonRGBA in SDLGfx seems to be broken somehow > > by using this (sample) call to the method: > > short[] sx = { 10, 10, 105, 10 }; > short[] sy = { 5, 7, 100, 5 }; > SDLGfx.aapolygonRGBA( surface , sx, sy, (short)255, (short)255, > (short)255, (short)255 ); > > i get my gamescreen but no drawn polygon and after a while some lines > which cover the whole surface appear, additionally they seem to appear > spontaniously after some frames more or less everytime i restart the > whole thing > > unfortunatly i just tried to do a screenshot of the lines ... but they > didn't appear at all ... neither the polygon was drawn > > i'm using sdljava-0.9.0 and the sun jdk 5.0 running on a gentoo system > with a current 2.6.10 kernel (with those thousand gentoo patches) > > greetz Goliat > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |