Re: [sdljava-users] Problem with sdl_gfx -> aaPolygonRGBA
Status: Beta
Brought to you by:
ivan_ganza
|
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
>
>
|