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
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
There does seem to be a problem with it in 10.051 :
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...
Array size : 0
Success
Width : 128 Height : 240 Size : 0
Internally passing "pix" as a reference helped. DOH!
Update tonight.
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
It sounds as though they dont have the required OpenGL extensions... :rant:
Update the graphics drivers. The Intel surely can do framebuffers.
Not sure about virtualbox, but there should be drivers as well.
VirtualBox has an "Enable 3D acceleration" option that isn't checked by default for any machine you create. Maybe it's that.
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]
Well, 3D emulation on Virtualbox for Macos NOT work. I use GLB 10.118.
But.... in same machine works perfectly compiled for OS-Uni. ;)
(https://lh5.googleusercontent.com/-FPV2ZCYSIv4/To9fSsvLqaI/AAAAAAAABlc/wGlFUcJUJ8Q/s640/Captura%252520de%252520pantalla%2525202011-10-07%252520a%252520la%252528s%252529%25252022.15.41.png)
This snapshot are from my code for TINT grayscale sprite to one unique color gradation.
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.
Quote from: Kitty Hello on 2011-Oct-07
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: