Author Topic: sprite2mem issue  (Read 1583 times)

Offline Scott_AW

  • Mr. Polyvector
  • ***
  • Posts: 214
    • View Profile
    • SAW Game Design
sprite2mem issue
« 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?
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

MrTAToad

  • Guest
Re: sprite2mem issue
« Reply #1 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]

Offline Scott_AW

  • Mr. Polyvector
  • ***
  • Posts: 214
    • View Profile
    • SAW Game Design
Re: sprite2mem issue
« Reply #2 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
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

MrTAToad

  • Guest
Re: sprite2mem issue
« Reply #3 on: 2010-Sep-12 »
Are you using this with SETCOLOR ?

Offline Scott_AW

  • Mr. Polyvector
  • ***
  • Posts: 214
    • View Profile
    • SAW Game Design
Re: sprite2mem issue
« Reply #4 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.
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/