ArgumentException: "The back buffer size requested is too large or too small." in CCDrawManager

Topics: Windows Phone 7
Sep 23, 2013 at 12:16 PM

I downloaded the latest version of the master branch last friday and wanted to integrate it in an existing application (up till now I was using a version of a couple months old).

When the application starts I get an exception on the last line of CCDrawManager.SetOrientation ( m_GraphicsDeviceMgr.ApplyChanges() ). The exception is an ArgumentException: "The back buffer size requested is too large or too small."

For the integration I use the Cocos2D.Phone project.

p.s. It ssems that there is also a problem with my visual studio recognising the namespace. Everything compiles fone; but the the class names do not appear in the right color in visual studio.

Sep 23, 2013 at 3:46 PM
Hi Tom, I had the same problem on Saturday and fixed up the projects for WP7. I was able to run them in the simulator as of yesterday.

When did you get the latest?
Sep 23, 2013 at 5:38 PM

I downloaded the code last Friday. I will try again tomorrow.

Thanks for the quick response.

Sep 24, 2013 at 11:14 AM

I just downloaded the latest version from the master branch and the problem still occurs. I have tested on two devices (one WP7 and one WP8) both with a screen resolution of 480x800.

I have done a complete rebuild.
  • Can you tell me what you changed for fixing it?
p.s. Visual studio is now recognizing the namespaces.

Best regards,
Sep 24, 2013 at 9:08 PM
Are you trying the tests for WP7 or your own game?
Sep 24, 2013 at 10:13 PM
I just built and deployed the WP7 tests over to my HTC WP7 device. No problems.

Are you testing in portrait? Make sure you are setting the backbuffer dimensions correctly at the start of your game. I think there might be a problem with adjusting the portrait dimensions upon startup.
Sep 25, 2013 at 9:37 AM

my game is indeed in portrait mode. I resolved the problem by setting the BackBuffer when the GraphicsDeviceManager is created.

the code of my game class looks like this:
public class MyGame : Microsoft.Xna.Framework.Game
    public MyGame()
            graphics = new GraphicsDeviceManager(this);

            // Need to swap for portrait mode
            int swappedBackBufferWidth = graphics.PreferredBackBufferHeight;
            int swappedBackBufferHeight = graphics.PreferredBackBufferWidth;

            graphics.PreferredBackBufferWidth = swappedBackBufferWidth;
            graphics.PreferredBackBufferHeight = swappedBackBufferHeight;

            // Do all the rest

            // Cocos 2D Initialization
            CCApplication application = new AppDelegate(this, graphics);
Thanks for the help. Any idea why it was working in the older version of Cocos2DXNA? Up till now I was using a version that I downloaded end of June (I don't know the exact date anymore).

Sep 25, 2013 at 3:35 PM
Hi Tom, it's a regression bug. I saw it on our current game that uses Portrait mode.
Sep 25, 2013 at 4:48 PM
This is how I fixed it in our game:

public Game1()
// other ctor stuff
        graphics.PreferredBackBufferHeight = 800;
        graphics.PreferredBackBufferWidth = 480;
        graphics.PreferMultiSampling = true;
        graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
        graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;

We will fix this bug today.