Content.Load<Texture2D>() is NOT Implmeneted for Windows Phone?

Created a new project for WP. Using install-package command added reference for MonoGame 3.2 DLLs. The content is simply a PNG file placed under a folder named ‘Content’ in the same project (the content pipeline template is broken somehow, could that be the reason?).

Faced NOT Implemented exception at Content.Load<>(). Interestingly the same method works just fine with same setup in a Windows Store app. Please suggest?

As far as I know you cannot use the content manager to load textures from PNG. You have to use Texture2D.FromStream.

K, seems FromStream() is also throwing NOT implemented exception.

But I want to start from scratch. Can you help me find ContentPipeline tool and a reference document detailing current and future of Content Pipeline in Mono Game?

The pipeline toolset is currently in development. You can find the documentation here:
http://www.monogame.net/documentation/?page=Pipeline

It says,

Currently the Pipeline Tool is only available on Windows and is part of the SDK installation.

I installed 3.2 using Windows Installer. Couldn’t find it? Is this available on Git or not yet released and I can get the source and build from there? Just point me in the right direction please. Thanks

Got how to access Pipeline.exe tool from this thread, How to access Pipeline.exe?

I dont use the content pipeline at all, except for SpriteFont. This is how I load my pngs (this is not my invention, i found it during googling my other problems :slight_smile: ):

public Texture2D TextureFromStreamForWP8(GraphicsDevice graphicsDevice, Stream stream)
{
    Texture2D result = null;
    var image = new BitmapImage();
    image.SetSource(stream);
    var bitmap = new WriteableBitmap(image);
    var pixels = SetColorsFromPixelData(bitmap.Pixels);
    Texture2D texture2D = new Texture2D(graphicsDevice, bitmap.PixelWidth,
      bitmap.PixelHeight);
    texture2D.SetData(pixels);
    result = texture2D;

    return result;
 }

private Color[] SetColorsFromPixelData(int[] pixelData)
{
   var Colors = new Color[pixelData.Length];
   for (var i = 0; i < pixelData.Length; i++)
   {
      var packedColor = pixelData[i];
      Color unpackedColor = new Color();
      unpackedColor.B = (byte)(packedColor);
      unpackedColor.G = (byte)(packedColor >> 8);
      unpackedColor.R = (byte)(packedColor >> 16);
      unpackedColor.A = (byte)(packedColor >> 24);
      Colors[i] = unpackedColor;
     }

     return Colors;
 }

And this is how I am using these:

private void AddTextures()
{
string[] textureDirectories = new string[]
{
“.\Content\Graphics\BackgroundElements\”,
“.\Content\Graphics\Backgrounds\”,
“.\Content\Graphics\Characters\”,
“.\Content\Graphics\GameElements\”,
“.\Content\Graphics\Menu\”,
“.\Content\Graphics\Levels\”
};

        using (var are = new System.Threading.AutoResetEvent(false))
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    foreach (string directory in textureDirectories)
                    {
                        foreach (string fileName in Directory.GetFiles(directory))
                        {
                            using (FileStream fs = new FileStream(fileName, System.IO.FileMode.Open))
                            {
                                ...
                                    Texture2D loadedImage = TextureFromStreamForWP8(_GameEngineManager.GraphicsDevice, fs));
                                 ...
                            }
                        }
                    }
                    are.Set();
                });
            are.WaitOne();
        }
    }

EDIT: Version 3.3

Following code works fine for me:

  protected override void LoadContent()
        {
            ...
            myTexture2D = Content.Load<Texture2D>("TextureInContentasPNG");
            ...

But you have to set the XYZ.png file in the “Copy to OutputDirectory” option to “Copy Always”.

EDIT: And the XYZ.png file has to be in the Content folder.

Faic you are probably using the develop branch from git? The user is on “stable” 3.2 i think.

I’m sorry, didn’t read it carefully enough. Yes, I’m on 3.3
EDIT: But in 3.2 you should be able to load xnb files with:

 protected override void LoadContent()
        {
           ...
            myTexture2D = this.Content.Load<Texture2D>("myXNBfileInContentFolder");
           ...
        }

If you want to convert PNG to xnb google for XNAContentCompiler.exe … but the xnb files are getting really large.