PNG image colors not correctly displayed

Hi all

I’m now on monogame 3,7, using visual studio for Mac.
For my game I display some PNG images.
On Android, no problem, all is fine !
On IOS, with the SAME FILES, colors are not correctly displayed !
Transparency seems to make shit on IOS…

I already tried to play the “blendstate” but this change nothing…

What’s the solution ?

Pit

Can you share more about what you’re doing? I had no issues getting PNGs to work on iOS the same way they did on PC.

Hi

here is what I’m doing:

private Texture2D sprtA;


sprtA = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(“Content/beetleA.png”));


graphicsMgr.GraphicsDevice.SetRenderTarget(renderTarget); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);


spriteBatch.Draw(sprtA, new Vector2((Constant.SCR_WIDTH - screen.Width) / 2, (Constant.SCR_HEIGHT - screen.Height) / 2),Color.White);


spriteBatch.End();
graphicsMgr.GraphicsDevice.SetRenderTarget(null);

As you can see, it’s very simple.

Cheers

Pit

dear all

nobody has same problems with PNG & Monogame under IOS ?

Could you upload a screenshot of what the texture looks like and what it should look like.
Can you also try processing the png file with the Pipeline Tool with Premultiply Alpha set to true? If that works this might be related to how the blend state is set on GLES.

I will try using the pipeline. Once done, I will let you know the result

1 Like

I don’t see any link with netgear router… :slight_smile:

Hi Jjagg,

using Pipeline and format file .XNB, it works correctly !!!
:slight_smile:
So:

  • under Android, these .png are OK
  • under IOS, .png NOT OK, .xnb OK

what can explain this difference ?

Pit

It might be there are issues with how blend states are set in iOS. Though I think the code is identical to Android, so I’m not sure. But it seems like the issue is with blend state at least. If you load an asset with FromStream the alpha is not premultiplied. That means transparency won’t be rendered with SpriteBatches default blend state. However things should work with BlendState.NonPremultplied.

Hi Jjagg,

I tried with blendstate.nonpremultiplied but the result is the same: NOT OK !
so, the only way to use these .png on IOS is to convert them to .xnb

pit

1 Like

Yeah, that sounds like a bug.

It’s spam, we’ve had a couple of those. I deleted the post and his account.

ah ok :slight_smile:
sorry :slight_smile:

so I deleted my answer :slight_smile:
pît