LOADSPRITEMEM is not working, pix[] always empty?

Previous topic - Next topic

BdR

Hi all,

I was trying the new LOADSPRITEMEM function, which could do some cool sprite manipulations in combination with MEM2SPRITE. However, I cannot get it to work properly, the pixel array seems to be empty, BOUNDS(pix[],0) is always 0. This seems like a bug.. or maybe I am doing something wrong?

I assume the width, height and pixel[] parameters are BYREF, I mean they are output parameters and the function will set those values? Here is my code, the screen stays blank and doesn't show the sprite and the DEBUG ouput is this:

LOADSPRITEMEM - success! xSize=38 ySize=50 BOUNDS(Pixels[],0)=0

Code (glbasic) Select
TestSpriteMem()
END

FUNCTION TestSpriteMem%:

  // variables
  LOCAL xSize%, ySize%, Pixels%[]
  LOCAL bResult%

  // load sprite into array
  bResult = LOADSPRITEMEM("mario.png", xSize, ySize, Pixels[])

  // no loading errors?
  IF (bResult = TRUE)
    DEBUG "LOADSPRITEMEM - success! xSize="+xSize+" ySize="+ySize+" BOUNDS(Pixels[],0)="+BOUNDS(Pixels[],0)+"\n"
    MEM2SPRITE(Pixels[], 0, xSize, ySize)
    DRAWSPRITE 0,0,0
  ELSE
    DEBUG "LOADSPRITEMEM - error!\n"
  ENDIF

  // display result and wait
  SHOWSCREEN
  MOUSEWAIT

ENDFUNCTION


edit:
forgot to mention, I'm working with GLBasic IDE v9.040

MrTAToad

There does seem to be a problem with it in 10.051 :

Code (glbasic) Select
LOCAL w%, h%, pix%[]
IF LOADSPRITEMEM("Media/smalfont.png", w%, h%, pix%[])
   DEBUG "Array size : "+BOUNDS(pix%[],0)+"\n"
   MEM2SPRITE(pix%[],0, w%, h%)
   DRAWSPRITE 0,0,0
   DEBUG "Success\n"
ELSE
DEBUG "Failed\n"
ENDIF
DEBUG "Width : "+w%+" Height : "+h%+" Size : "+BOUNDS(pix%[],0)+"\n"
SHOWSCREEN
MOUSEWAIT


Its succeeding, but the size of pix%[] is 0...

Code (glbasic) Select

Array size : 0
Success
Width : 128 Height : 240 Size : 0

Kitty Hello

Internally passing "pix" as a reference helped. DOH!
Update tonight.

Hark0

Hi!

I tried to use SPRITE2MEM for tint grayscale PNG...

Works well on some devices... FAILS IN SOME VIDEOCARD DEVICE!!!  (Sprite missing/empty)

OK on iPad.
OK on PC with Geforce 8800 GS

FAIL on VirtualBox (Macos emulation winxp)
FAIL on PC with Intel 915GM


:blink:

TIA, Hark0
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

MrTAToad

It sounds as though they dont have the required OpenGL extensions...  :rant:

Kitty Hello

Update the graphics drivers. The Intel surely can do framebuffers.
Not sure about virtualbox, but there should be drivers as well.

Ruidesco

VirtualBox has an "Enable 3D acceleration" option that isn't checked by default for any machine you create. Maybe it's that.

Hark0

Quote from: Kitty Hello on 2011-Oct-07
Update the graphics drivers. The Intel surely can do framebuffers.
Not sure about virtualbox, but there should be drivers as well.

Unfortunately my OLD videocard are at last driver. Intel® 915GM 6.14.10.4764.  :(

I try Ruidesco solution for emulated machine on my Mac.

EDIT: I add a report file of my Videocard made with Everest.

[attachment deleted by admin]
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Hark0

Well, 3D emulation on Virtualbox for Macos NOT work. I use GLB 10.118.

But.... in same machine works perfectly compiled for OS-Uni.  ;)



This snapshot are from my code for TINT grayscale sprite to one unique color gradation.
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic

Kitty Hello

Code (glbasic) Select

      GL_ARB_fragment_program                           Supported
...
      GL_ARB_framebuffer_object                         Not Supported


What idiot writes a driver that has SHADER SUPPORT!!! but no framebuffer object!?
It's like having a car with electric seats and light-wipers, but no steering wheel.

Hark0

Quote from: Kitty Hello on 2011-Oct-07
Code (glbasic) Select

      GL_ARB_fragment_program                           Supported
...
      GL_ARB_framebuffer_object                         Not Supported


What idiot writes a driver that has SHADER SUPPORT!!! but no framebuffer object!?
It's like having a car with electric seats and light-wipers, but no steering wheel.

His name are Intel... :rant:
http://litiopixel.blogspot.com
litiopixel.blogspot.com - Desarrollo videojuegos Indie · Pixel-Art · Retroinformática · Electrónica Development Indie Videogames · Pixel-Art · Retrocomputing · Electronic