Using the Reference Rasterizer in XNA

Moglor's picture

hi, im having trouble with xna and my crappy integrated graphics adaptor. so i thought i would try your reference rasterizer class, but i dont know how to use it. can someone give me an example of how to implement it?

i'm new to c# and xna so please use detailed or easy explanations. thanks!

Cygon's picture

No problem! :)

Here's what you'll have to do:

  • Enable the Reference Rasterizer on your system. - I just extended my article with some
    screenshots showing how and where to do this
    (clicky)

  • Create a new XNA Game project and add an
    empty class to it
    - Should be pretty
    straightforward. Paste the code from my article
    into this class and replace the
    new GraphicsDeviceManager
    line in your game class with
    new ReferenceGraphicsDeviceManager

I also uploaded a fully prepared XNA Game template
to my site which you can download instead. It should
work out of the box, as long as you've got the
Reference Rasterizer enabled on your system:
Empty XNA Game using the Reference Rasterizer

Cygon's picture

Doh!

Sorry, I just re-checked my article on my laptop (which doesn't have a shader-capable graphics card) and it seems that Microsoft changed the behavior in the XNA 1.0 final release. You now need to clone the entire GraphicsDeviceManager to get the reference rasterizer working.

I updated the article and empty xna game a few seconds ago so it will work with the XNA 1.0 release. If you already downloaded the old reference rasterizer kit, make sure your browser cache doesn't still punch out the cached old version of the file (hint: the new file is 13 kb, not 6 kb :))

paulo.junior's picture

Problem With the Reference Rasterize Class

I had made everthing like you describe in all other topics, but I still having a problem, I just can't change the PreferredBackBufferHeight and PreferredBackBufferWidth of my ReferenceGraphicsDeviceManager object, the code runs, but nothing happens... Look my code:

public class Game1 : Microsoft.Xna.Framework.Game
    {
        ReferenceGraphicsDeviceManager graphics;
        ContentManager content;
        public Game1()
        {
            graphics = new ReferenceGraphicsDeviceManager(this);
            content = new ContentManager(Services);
        }
        ///
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        ///
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            graphics.PreferredBackBufferHeight = 480;
            graphics.PreferredBackBufferWidth = 640;
            graphics.ApplyChanges();
            Window.Title = "Joguinho Teste...";
            base.Initialize();
        }
...
}

P.s.: I'am using the most new version of the ReferenceGraphicsDeviceManager Class.

Cygon's picture

Try it in the Constructor

Have you tried putting that code in the constructor yet?

My class should have exactly the same behavior as the XNA GraphicsDeviceManager -- it's nothing more then a copy of the XNA code with some tiny adjustments to make it use the reference rasterizer. If it works with the XNA GraphicsDeviceManager but not with the ReferenceGraphicsDeviceManager, I'd be very much puzzled ;)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <br> <a> <em> <strong> <u> <i> <b> <cite> <blockcode> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre> <span>
  • You can highlight code with any of the following tags: <blockcode>

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.