Microsoft Developer Network > Forums Home > Archived Forums Forums > XNA Game Studio Express > The values used in the attempt to create the GraphicsDevice were invalid.
Ask a questionAsk a question
 

AnswerThe values used in the attempt to create the GraphicsDevice were invalid.

  • Wednesday, August 30, 2006 4:34 PMZaaM IT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Is this because my graphic card does not support shader model 2?
    I didn't even know of this requirement till I saw it on the readme file.
     
    Time to change my geforce4?

Answers

  • Wednesday, August 30, 2006 5:25 PMStruan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I got it to work. Add this line after the Graphics component is created:

    graphics.AllowMultiSampling = false;

    Then in the WindowsGame_Starting function set graphics.AllowMultiSampling equal to false again.

All Replies

  • Wednesday, August 30, 2006 4:43 PMPaul Bleisch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    What type of card do you have?  We should be giving a better exception message than that (i.e. we check for lots of things and throw better exceptions but that one must have slipped through.)
  • Wednesday, August 30, 2006 4:44 PMHaylwood Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'm getting the same error here at work..... card is an nVidia Quadro 2.  lol.... not sure if its the shader model or what.
  • Wednesday, August 30, 2006 4:49 PMZaaM IT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply Paul, I have a geforce 4 ti4200 on this pc.
     
    I get this error in the InitializeComponent method of the sample projects
  • Wednesday, August 30, 2006 4:50 PMHaylwood Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    And apparently I'm unable to make edits to my posts.

    Anyway, the error is this (it happens at runtime):

    "NoSuitableGraphicsDeviceException was unhandled" on line 26 of SpacewarGame.Design.cs
  • Wednesday, August 30, 2006 5:07 PMMClever Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Nvidia GeForce 4 Ti 4600 here, same error - total bummer too, might have to work on the laptop for a while until I either buy a new card or a solution arises... still, looks like nice concise code, reminds me of the Jad engine, good stuff guys at least from what I can see of it :)
  • Wednesday, August 30, 2006 5:25 PMStruan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I got it to work. Add this line after the Graphics component is created:

    graphics.AllowMultiSampling = false;

    Then in the WindowsGame_Starting function set graphics.AllowMultiSampling equal to false again.

  • Wednesday, August 30, 2006 5:33 PMMClever Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Struan wrote:

    I got it to work. Add this line after the Graphics component is created:

    graphics.AllowMultiSampling = false;

    Then in the WindowsGame_Starting function set graphics.AllowMultiSampling equal to false again.



    THAT WORKED!!
    Good on ya mate
    This is a congratulatory sheep ->
  • Wednesday, August 30, 2006 5:41 PMZaaM IT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yeah, that did it. Thanks a lot!
  • Wednesday, August 30, 2006 5:43 PMPaul Bleisch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Groovy.  This is a bug.  We're supposed to fallback to disable multisampling if it isn't available.  I'll file a bug.

  • Wednesday, August 30, 2006 5:48 PMaaron.lee.garrett Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I tried that, but I continue to get the same error. I'm just trying to build the basic Windows Game (XNA) project (from File->New). The relevant (I think) code looks like this:

    private void InitializeComponent()
    {
    this.graphics = new Microsoft.Xna.Framework.Components.GraphicsComponent();
    this.graphics.AllowMultiSampling = false;
    this.GameComponents.Add(this.graphics);
    }

    There's no WindowsGame_Starting function in this example.

    Any suggestions?

    AG

  • Wednesday, August 30, 2006 5:58 PMsefskillz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    try line 109 in SpacewarGame.cs
  • Wednesday, August 30, 2006 6:00 PMPaul Bleisch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Aaron

    What type of graphics hardware do you have?

  • Wednesday, August 30, 2006 6:15 PMaaron.lee.garrett Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    According to my Device Manager, I have a Rage 128 Pro Ultra GL AGP. What should I have in order to create and run games in XNA?

    AG

  • Wednesday, August 30, 2006 6:18 PMPaul Bleisch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    IIRC the Rage 128 is DX7 era hardware.  You'll need a card that supports the programmable pipeline (we recommend something that supports at least Shader Model 2.0 or above).  You can find reasonably priced SM2.0 cards these days (or check Ebay).

     

  • Wednesday, August 30, 2006 6:21 PMJim PerryMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You can try falling back to the reference rasterizer fix that was suggested in another post until you get a compatible card.
  • Wednesday, August 30, 2006 6:40 PMNaicigam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=672046&SiteID=1

    This is the post he talks about. If you can make it work, please tell me =o)

    Cheers!
  • Wednesday, August 30, 2006 7:15 PMviralspiral Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I tried xna on two machines, one had the issue and one did not. On my vista machine it did not happen. XpSP2, did happen. Setting multisampling to false did work.

    Thanks - Andrew

    XBL GT=ViralSpiral

  • Wednesday, August 30, 2006 7:22 PMSniper167 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Yeah I got the same error and I added the code line but it didn't work for me either, I don't know if I put it in the right spot though either, here's my code:

    using System;

    using System.Collections.Generic;

    using System.Xml;

    using Microsoft.Xna.Framework;

    using Microsoft.Xna.Framework.Graphics;

    using Microsoft.Xna.Framework.Components;

     

    namespace Spacewar

    {

    partial class SpacewarGame

    {

    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private void InitializeComponent()

    {

    this.graphics = new Microsoft.Xna.Framework.Components.GraphicsComponent();

    //

    // WindowsGame

    //

    this.Starting += new System.EventHandler<Microsoft.Xna.Framework.GameEventArgs>(this.WindowsGame_Starting);

    this.Exiting += new System.EventHandler<Microsoft.Xna.Framework.GameEventArgs>(this.WindowsGame_Exiting);

    graphics.AllowMultiSampling = false;

    this.GameComponents.Add(this.graphics);

    }

    private GraphicsComponent graphics;

    }

    }

  • Wednesday, August 30, 2006 7:26 PMNaicigam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I added

    graphics.ModifyDevice += new EventHandler<ModifyDeviceEventArgs>(graphics_ModifyDevice);

    but I don't know what to put inside to make the GraphicsComponent being of type DeviceType.Reference.

    Cheers!
  • Wednesday, August 30, 2006 9:29 PMDarkRage Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    That simple change at line 109 worked, thanks

     

    With FSAA enabled, it worked to change the resolution (for example, 1024x720).

    ATI Mobile X300

  • Wednesday, August 30, 2006 10:06 PMIBLUES Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have the following card in my laptop and I'm having a similar problem.

    Mobil Intel 915GM/GMS,910GML Express Chipset Family


    I add it the lines you wrote and I'm still getting the following error

     

    "Could not find a Direct3D device compatible with the current device preferences."

     

    Is it that my video card won't work? I had use Directx 9 before

     

    Thanks

    Francisco

     

  • Wednesday, August 30, 2006 10:50 PMTruePsion Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     

    Ok, here's what I got:

     

    ATI MOBILITY RADEON 9000 IGP, I have Service Pack 2, can run DirectX9.0c easily, I have all prerequisites & requirements I need...But I gut an error message along this line: this.GameComponents.Add(this.graphics);

     

    message: The values used in the attempt to create the GraphicsDevice were invalid.

  • Thursday, August 31, 2006 12:05 AMTruePsion Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I do not know if I can bump topics here but I do not know what the problem is. I have everything, I can run everything, I have a high graphics card and work DirectX9.0c easily....why can I not run any XNA games?
  • Thursday, August 31, 2006 1:18 AMscytherage Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, this thread was very helpful! The computer I'm using for this program isn't very well equipped (i think the graphics card is about two years old). I hope that the program won't require a very powerful PC....I don't plan on making a 3D game with this tool.
  • Thursday, August 31, 2006 1:28 AMsefskillz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    truepsion, have you tried this?

    Add the following to line 20 in SpacewarGame.Designer.cs

    graphics.AllowMultiSampling = false;

    and change line 109 in SpacewarGame.cs from

    graphics.AllowMultiSampling = true;

    to

    graphics.AllowMultiSampling = false;
  • Thursday, August 31, 2006 2:16 AMXNAConfused Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    how can u tell what line something is in?
  • Thursday, August 31, 2006 2:23 AMsefskillz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    use ctrl g and type in a line number; line number is also displayed in the bottom right corner. ex: Ln 109 Col 22 etc etc
  • Thursday, August 31, 2006 2:51 AMthe_developer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have an old graphics card, Nvidia Vanta/Vanta LT 16MB. When I try to debug appear an error in the file SpaceWarGame.Designer.Cs where it say:

    this.GameComponents.Add(this.graphics);

    Error say: The values used in the attempt to create the GraphicsDevice were invalid.

    So  I want to know the solution. For more info, I have no downloaded DirectX SDK yet. I hope you understand me and could help me

  • Thursday, August 31, 2006 3:11 AMSniper167 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Your graphics card is too old and XNA doesn't support that old of a graphics card. Sorry, you'll either have to Buy a new graphics card for that computer or use another computer with a newer card for XNA.
  • Thursday, August 31, 2006 1:48 PMHaylwood Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This worked perfectly for me, thank you!

    I tried it in a blank Windows Game project, just without the bit in WindowsGame_Starting().  Got the blank blue DX window coming up.
  • Thursday, August 31, 2006 2:03 PMNaicigam Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I read in another post that we can use the reference rasterizer, but it did not explained how to do it. Does anybody knows?

    Cheers!
  • Thursday, August 31, 2006 2:57 PMthe_developer Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    What graphics cards you recommend?

    And what about the reference rasterize? I think this is important.

  • Thursday, August 31, 2006 9:22 PMDavid Weller - NVIDIA Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    The reference rasterizer, found in the DirectX SDK, is a really bad idea.  It renders very slowly (seconds, sometimes minutes, per frame).  XNA was designed for DX9.0-capable graphics cards (which have been on the market for many years now).

    Then again, it's better than butcher paper and crayons

  • Thursday, August 31, 2006 9:40 PMChaosCentral Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     the_developer wrote:

    What graphics cards you recommend?

    And what about the reference rasterize? I think this is important.

     

    well the cheapest card with SM 3.0 is the GeForce 6200, you can pick one up for a little under 50 bucks(p.s. this is the card I'm using) Although you will need AGP 4x or higher(8x is recommended)

  • Friday, September 01, 2006 4:11 PMShadow Chaser Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    UGH! This *really* sucks - why on earth do I need a T&L card to program a 2D game? I don't even need hardware lighting, let alone shader models!!
  • Saturday, September 02, 2006 3:39 AMd-x-j Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    hello paul. i have the same error but i dont want to wait for MS to update.ima complete noob and i cant find where to add the line to set multi sampling to false.what file is it in?
  • Saturday, September 02, 2006 4:41 AMIGNUS1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I didnt found the WindowsGame_Starting in the project
  • Monday, September 04, 2006 2:30 AMvomnser Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    i modified file with your writed,however the error still exist.

    my graphics card is VIA/S3G Unichrome Pro IGP,

    is it my graphics card too old?

  • Thursday, September 07, 2006 9:01 PMMrGonzo1024 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have the same card, actually it's an on-board chipset that comes with my HP desktop.  and I have the same problem. 

    When I run DXCapsViewer it shows under D3D Device Types/HAL/Caps PixelShaderVersion to be 0.0.  So, I assume that means my card is not supported.

    This presents a problem for me.  I don't have a problem going out and buying a card for development, but I'm worried about limiting the market for my games.  I was hoping to use this framework to help me build 2D games, which will not required hardware shading, etc.  I don't think my target audience will be willing to go out an buy a card to run my games.

    Is there a way to turn this requirement off in my final build?
  • Friday, September 08, 2006 4:06 AMPaul Bleisch Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    There are currently no plans to change the programmable shading requirement.  We're interested in feedback around hardware "reach" for future versions.

     

    Thanks,

  • Saturday, September 09, 2006 3:14 AMMartin Harris Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Struan:

    Can you point me to the location where the graphics component is created?

     

    Thanks

  • Friday, September 22, 2006 8:06 PMTheoxylo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Adding "graphics.AllowMultiSampling = false" in both places mentioned solved the problem for me and my laptop (ATI Mobility Radeon 9000). Thanks!

  • Saturday, September 23, 2006 12:48 AMlynnvm Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    So there is no work-around this problem at all? (My laptop is not much more than a year old and runs quite a few games just fine.)

    My husband has a new Macbook Pro- If I install Bootstrap and Windows on it, will it work with XNA Express?

  • Saturday, September 23, 2006 1:32 AMlynnvm Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I got it to work.
  • Tuesday, September 26, 2006 7:03 AMDave Kaplan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Struan U RULE!!!!

    I knew it was in there somewhere, but I wasn't sure what...  thanks!
  • Friday, October 27, 2006 7:54 PMJeff Collins Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I think it would be really, really good if this required were removed.  I have a brand new PC that I can not use to run XNA based games (it has a VIA/S3G UniChrome Pro IGP chip onboard).  I am guessing that I am not the only person - or likely to be the only person - with this problem.  It is especially frustrating given that I am not even attempting to do anything complicated...  just write a simple 2d game...  I could see it if I were writting a massive 3d game...

    Jeff Collins

  • Thursday, February 08, 2007 1:32 AMPranavan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I don't know if this is the right place to start, but I'd like to find out if any of you know where to find support for ATI Mobility Radeon 9000 display drivers. I have the IGP series, and I have looked everywhere for updates. I have found some compatible drivers, but everytime I attempt to install them I receive an error message that states that there is no display driver found.

    The reason I am looking for drivers (or any useful information that can solve this problem) is that I have a subscription to EVE on-line and during game play my computer freezes up. Once I reboot, I receive an error message that states that the ati2dvag is no longer working properly. My computer meets the minimum systems requirement for EVE and I have tried several attempts to troupleshoot this problem through Windows update.

    If has any useful info, or knows of anyone who could help, please send this tread to them. Cheers