Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / GetImage() HTML5 Transparrent areas showing black

Author
Message
notredame1250
8
Years of Service
User Offline
Joined: 15th Oct 2015
Location:
Posted: 23rd May 2016 19:52
Hi,
I am having an issue using GetImage() with DrawSprite() using HTML5 in AGK 2.0.19

My example takes a 220px by 220px image, does GetImage at 311 by 311. So this adds a transparent "border" around the sprite.
On my PC it shows up correctly by leaving the transparent areas transparent but when run with HTML5 it shows black for the transparent areas of the sprite.
Same when using Scissor on a sprite and the GetImage() to get the new shape.

Does anyone know what I am might be able to do different to handle this type of scenario or maybe this is an issue with AppGameKit 2.0.19 for HTML5?

Included is my test code.

Code of GetImage() with DrawSprite()


On my Windows 7 machine:


On Chrome/Firefox HTML5:


Thanks,

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th May 2016 15:11
The WebGL back buffer may not have alpha, the only thing I can think to try would be to draw a 100% transparent sprite that covers the area you want to be transparent, but it's a long shot.
notredame1250
8
Years of Service
User Offline
Joined: 15th Oct 2015
Location:
Posted: 25th May 2016 16:33
Thanks for the reply,

Unfortunately it didn't work, still the same problem.
I tried SetImageTransparentColor() to Black and it didn't work either when run in HTML.

Is there a way that SetImageMask or other technique to make the black part of the image/sprite transparent?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 25th May 2016 17:14
SetImageTransparentColor should work, did you make sure to use SetSpriteTransparency(ID,1) afterwards, as the sprite still thinks it's using a non-transparent image.
notredame1250
8
Years of Service
User Offline
Joined: 15th Oct 2015
Location:
Posted: 25th May 2016 17:38
It worked!
Thank you.

Though because now my shapes can't have black pixels it is limited the images I can use for the main image.

Is the WebGL back buffer alpha something that will be updated?

Thanks again
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 26th May 2016 19:50
You could use a color of 1,1,1 which will look black, although it's not ideal.

The WebGL back buffer may be out of our control but I'll look at it when I get a chance
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th May 2016 08:42
I hope there is something in WebGL to resolve this one. I have apps that use GetImage on images with varying levels of transparency.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 29th May 2016 22:01
Quote: " I hope there is something in WebGL to resolve this one. I have apps that use GetImage on images with varying levels of transparency."


I use this extensively myself. I tested one app and it worked almost entirely in HTML5 except for this transparency issue, which breaks the app.

Login to post a reply

Server time is: 2024-04-19 15:52:55
Your offset time is: 2024-04-19 15:52:55