GLBasic forum

Main forum => Bug Reports => Topic started by: Scott_AW on 2010-Sep-12

Title: sprite2mem issue
Post by: Scott_AW on 2010-Sep-12
I started to use sprite2mem in my image to voxel program, to replace the inaccurate and slow process of using get pixel.

I managed to somewhat correct the colors since its ABGR instead of simple RGB, but seem to get neon colors.

The main problem is everything was fine when working on one computer, however when I tried things on two different systems the sprite2mem was no longer storing the data.  I found this out by trying to convert it back to a sprite and ended up with an empty image.

The first system had a decent graphics card, I think ATI.

The second system had on board video, probably nothing that powerful.

The third system was my netbook which normally runs everything fine with it's intel 3150 graphics chip.

All systems are running XP.

Any ideas on what might be wrong?
Title: Re: sprite2mem issue
Post by: MrTAToad on 2010-Sep-12
How are you calling SPRITE2MEM and MEM2SPRITE ?

I've included my compressed graphic display routine which uses MEM2SPRITE - give that a go on all machines and see what happens

[attachment deleted by admin]
Title: Re: sprite2mem issue
Post by: Scott_AW on 2010-Sep-12
I'll give that a try on a few systems to see what happens.

Here's the jist of what I have...

Code: (glbasic) [Select]
GLOBAL sprdrop%[]
DIM sprdrop%[500000]

GLOBAL file$ = "test.png"

LOADSPRITE file$, 1
SPRITE2MEM(sprdrop%[], 1)


Here's how I was extractng the colors, but they were coming out neon.  I reversed the order of the break down to compensate for ABGR instead of RGB, but I might be missing something.
Code: (glbasic) [Select]
FUNCTION makecolor: value, color
  SELECT color
    CASE 0; //RED
      RETURN bAND(value/(256*256), 255)
    CASE 1; //GREEN
      RETURN bAND(value/256, 255)
    CASE 2; //BLUE
      RETURN bAND(value, 255)
  ENDSELECT
ENDFUNCTION
Title: Re: sprite2mem issue
Post by: MrTAToad on 2010-Sep-12
Are you using this with SETCOLOR ?
Title: Re: sprite2mem issue
Post by: Scott_AW on 2010-Sep-12
Nope, just storing that data else where for later.

I may just try again from scratch, I could have messed something up along the way.

Your example seemed to work fine.