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 / Problem with DrawSprite() on MAC

Author
Message
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 21st Nov 2015 02:25 Edited at: 21st Nov 2015 02:26
Anyone know why I get black dots around sprites drawn to the screen?

I am using this function to paint the sprite to the screen:



and am using 2 render images like double buffering.
The sprite is a simple circle of 1 colour on transparent background with no antialiasing and is 512 x 512 in size which is scaled for various brush sizes.

Screen size 1280 x 800
Render images 1024 x 512

It's baffling me a bit and I have also tried:
SetImageMinFilter(brush, 0)
SetImageMagFilter(brush, 0)
on the brush image.


Cheers guys


Image output below:

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Attachments

Login to view attachments
nickele upgraded
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Birthplace of Democracy
Posted: 22nd Nov 2015 10:27
Maybe the painting/drawing program that you used, had antialiasing activated and gave these extra pixels to edges?
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 22nd Nov 2015 13:15
No it is just one colour with no antialiasing, I have uploaded it here.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Attachments

Login to view attachments
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 22nd Nov 2015 14:58
Just been testing this again and I think it is a bug with iOS because on Windows and Android there is no problem with it at all and you don't get the black dots but on iOS/Mac you get the above mess.

Think this might be one for you to check Paul???


Cheers.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 22nd Nov 2015 18:15
The noise looks round , perhaps its just mip maps , the image is 512x512 , try SetGenerateMipmaps(0)
best regards Preben Eriksen,
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 22nd Nov 2015 20:39
Doesn't make any difference but if I set SetGenerateMipmaps(1) then it gets really bad.
Again it doesn't do this on Windows or Android.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Nov 2015 00:21
The more I mess with this the more I am convinced its a bug with iOS.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Nov 2015 00:29
Something even more strange, on Windows as I said it is fine. Broadcast on Android from Windows is also fine. iOS is messed up but broadcast on Android from the Mac is also messed up!
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Nov 2015 00:41
Also now using this brush which is 128 x 128 as the maximum brush size is 128 and uses less memory for the image. Still no joy though.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Attachments

Login to view attachments
haliop_New
User Banned
Posted: 23rd Nov 2015 05:41
have you tried bigger render to image resolution ?
2048x2048 ?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 23rd Nov 2015 09:37
Also, try changing the min/mag filter settings. See:
SetDefaultMinFilter
SetDefaultMagFilter


V2 T1 (Mostly)
Phone Tap!
Uzmadesign
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Nov 2015 17:19
I have tried increasing the render image but this just makes the black outline more visible due to higher resolution and the SetDefault Min/Mag Filter makes no dif as I already tried it.


I really do think this is a bug with iOS and the render images. I know before it was sorted out for Android it worked in iOS or seemed to do but it isn't right.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Nov 2015 21:57
In your screenshot none of the dots appear in any of the circles, so I would look at how you are setting the initial green color background. If you use a large green sprite to set the initial color does the problem go away?
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 23rd Nov 2015 23:02
Think its the same problem: https://forum.thegamecreators.com/thread/215702?page=3#msg2573645
best regards Preben Eriksen,
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Nov 2015 23:46
Quote: "In your screenshot none of the dots appear in any of the circles, so I would look at how you are setting the initial green color background. If you use a large green sprite to set the initial color does the problem go away?"


Sorry Paul I should have explained myself a bit better, the screen shot is made from the one sprite by painting the circle to make the green background and the dots on the green are left from the painting of the circle over the screen. I then painted single circles to show that the dots are made around the outline of the circle.

The code to do this is one from a while ago where I was trying to do a drawing/painting routine and you assisted with it then in this thread:
https://forum.thegamecreators.com/thread/214648

i think you have since sorted render images for Android and Windows but there still seems to be problems with iOS. I thought it was fine as on the phone it looked ok due to the small size of the screen as you couldn't see the dots as much but on the mac and clearer screen it stands out like a sore thumb.

If you put the above 128 x 128 brush on a post further up with this code you will see what is happening on the mac. I think it may be a bug with the render images on iOS.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 00:33
Okay been messing with this some more, the code below doesn't need a brush loading in now but just change the following line in the code to make a square or circle brush to see the difference.

//iBrush = GetImage( 0, 0, 128, 128 )
iBrush = CreateImageColor(255,255,255,255) // If you change this line for the one above you can see it doesn't do it on a square.


It has to be something in rendering the curve of the line of the circle.



The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 00:49
Right I am going absolutely bloody crazy I have just put:

SetDefaultMinFilter(0)
SetDefaultMagFilter(0)

just before the iBrush = bit and it works fine now!
I swear to god I tried this before so I thought it might be because I am no longer loading in a brush. I changed it again and loaded the brush in with the same Set Min/Mag and it worked again ok!!!!


I really don't know what to think now, am I going crazy !!! lol Anyway it's working !!! haha
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Nov 2015 00:56
Then it sounds like it might be an issue with pre-multiplied alpha. iOS and Mac both prefer to deal with pre-multiplied alpha images when loading or saving, so if the alpha value makes the pixel completely transparent then it removes all the color information. AppGameKit uses straight alpha, so when it loads an image on iOS or Mac and converts it to straight alpha it ends up with black for the transparent pixels since that color is lost. This then causes blending artifacts since the boundary has alpha going from 255->0 and the color going from color->black so you will end up with some black bleeding through. Whereas on Android and Windows the color is preserved so the boundary has alpha going from 255->0 but color doesn't change.

I'll see if I can load images on iOS and Mac as straight alpha, but I remember looking at this a while ago and leaving it as it is for some reason.

Quote: "Think its the same problem"

Yes it sounds like the same problem.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 01:26
Thanks for looking at this Paul, thought I was going mad but at least it is working ok now

On another issue though, my program uses this command - PrintImage(1,100) to print or save the image on either mac or iOS and I just tried it after drawing a nice picture haha but it now says that AppGameKit is not allowed to print???? Has this command been taken out or has AppGameKit not set to allow printing in 2.0.15d??


Cheers.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Nov 2015 03:07
Sounds like a permission issue, Mac will try to send it to a printer, iOS will try to send it to the Photo library, both platforms are heavily locked down these days.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 10:09
Quote: "Sounds like a permission issue, Mac will try to send it to a printer, iOS will try to send it to the Photo library, both platforms are heavily locked down these days."


Yes sounds like it. It worked fine on both iOS and mac on the older .14 version of AGK.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 24th Nov 2015 11:06
Quote: "Also, try changing the min/mag filter settings. See:
SetDefaultMinFilter
SetDefaultMagFilter"
Anytime Hehe
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 15:17
Quote: "Anytime Hehe"


Cheers CJB I had a look and I realised that before when I tried it I stupidly put the commands after loading the image in haha
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 19:18
Quote: "Sounds like a permission issue, Mac will try to send it to a printer, iOS will try to send it to the Photo library, both platforms are heavily locked down these days.
"


Is this something that will need a change in the next update?
i know Apple are getting a bit of a pain lately with everything they ask for!
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Nov 2015 20:35
Mac apps require the features used to be set in XCode when building the app, since the AppGameKit player is the same for everyone then I would have to set the printing permission for everyone. Unfortunately Apple may reject apps that request permissions they don't use, so since most people won't be using the print permission it seems safer to leave it out. This does mean you'd have to build your own Mac player to have the printing permission, but this should be as simple as opening the interpreter_mac project in XCode, ticking the printing permission, and then exporting your app. If you place your media folder inside the Resources section you will get a standalone app.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Nov 2015 23:03
Quote: "Mac apps require the features used to be set in XCode when building the app, since the AppGameKit player is the same for everyone then I would have to set the printing permission for everyone. Unfortunately Apple may reject apps that request permissions they don't use, so since most people won't be using the print permission it seems safer to leave it out. This does mean you'd have to build your own Mac player to have the printing permission, but this should be as simple as opening the interpreter_mac project in XCode, ticking the printing permission, and then exporting your app. If you place your media folder inside the Resources section you will get a standalone app."


Jesus, I hate this blasted Apple/AGK situation sometimes. OK so I thought I would try this with one of the folders I already have set up and works on the Mac for Paint Pot but it looks like the template has now changed since the update of AppGameKit (maybe a new template?). Using Xcode, I loaded in Paint Pot with the modified template from .14 AppGameKit which already had the printer tick box selected and has all the icons and settings etc changed for it to work but there were errors this time and it wouldn't work. Have some of the directories/paths changed in the new version of .15 for the include files as it came up with the errors saying it can't find them??

I really don't fancy having to go through the headache again of setting up my programs with the new template just because paths have changed. This would be a right ball ache because it was hard enough to do the last time!

What is the situation for iOS creating the app from within AppGameKit and the print file thing? Does this not work now or does this sort itself out in AppGameKit tier 1 because I do all the coding in tier 1 for iOS and mac.
The sooner AppGameKit can export for iOS, mac, android, etc from within the editor the better without having to use the dreaded damn Xcode which I bloody hate with a vengeance!!
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Nov 2015 00:55
Right just updated all the projects for MAC with the new interpreter mac folder for Xcode and all is working and you will be pleased as I am anyway that the print function works by doing the check box just not in AppGameKit which is fine and makes sense.

I have to create a new player for the iPhone yet so haven't tried exporting anything to it but will test the print/save function soon on that but would creating an app from the AppGameKit editor for tier one take care of that though for iOS devices like iPads and iPhones as they used to do?

Cheers.


When I get chance I will do a tutorial on exporting a project to the MAC from a tier 1 program using the interpreter template and Xcode so it hopefully won't be a mystery to people starting out.
I know when I first did this it was a massive headache and I was dreading updating them but it seemed a lot easier this time, not sure if it was because I sort of knew what I was doing or if the template is easier to read??
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 25th Nov 2015 03:39
Quote: "would creating an app from the AppGameKit editor for tier one take care of that though for iOS devices like iPads and iPhones as they used to do?"

Yes, it works on my iPad.
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Nov 2015 15:17
Quote: "Yes, it works on my iPad."


Cool, cheers Paul. Will update my phone player tonight.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Nov 2015 15:55
Just updated the player on the iPhone and all is well it is working
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Nov 2015 18:28
https://forum.thegamecreators.com/thread/215918#msg2573764

Okay here is the link to get a tutorial on getting your app on the Mac Store.


Cheers.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Login to post a reply

Server time is: 2024-04-20 04:21:52
Your offset time is: 2024-04-20 04:21:52