Address: http://www.cnblogs.com/kkun/archive/2008/02/21/1076533.html
Today, I want to try xna2.0, which is not fun. As a result, I encountered a problem. After xNa studio is down from the Internet, the installation went smoothly,
After DX9 is installed, everything goes smoothly. Create a project and run it. An error is reported!
Cocould not find a direct3d device that has a Direct3D9-level driver and supports pixel shader 1.1 or greater.
Check the results on the Internet first. The results show little Chinese information. I learned from some websites that the display is too old. The answer is: Change the video card;
Later I found an article that mentioned that I could change the rendering method and specify it as a software simulation instead of using hardware. Because I have been studying DX for a while,
I feel that this should be a solution. Of course, it depends on this idea to solve the problem. This article does not ultimately solve the problem, but it also helps a lot,
Let's look at the initial code first,
Public class game1: Microsoft. xNa. Framework. Game {
Graphicsdevicemanager graphics;
Spritebatch;
Public game1 (){
Graphics = new graphicsdevicemanager (this );
Content. rootdirectory = "content ";
}
Only part of the code is pasted here, which is to construct a game1 and then execute
Static class program {
/** // <Summary>
/// The main entry point for the application.
/// </Summary>
Static void main (string [] ARGs ){
Using (game1 game = new game1 ()){
Game. Run ();
}
}
Then an error is reported, such as the title description;
To use software rendering, modify the Code as follows:
Public class game1: Microsoft. xNa. Framework. Game {
Graphicsdevicemanager graphics;
Spritebatch;
Public game1 (){
Graphics = new graphicsdevicemanager (this );
Content. rootdirectory = "content ";
Graphics. preparingdevicesettings + = new eventhandler <preparingdevicesettingseventargs> (graphics_preparingdevicesettings );
}
Void graphics_preparingdevicesettings (Object sender, preparingdevicesettingseventargs e ){
E. graphicsdeviceinformation. creationoptions = createoptions. softwarevertexprocessing;
E. graphicsdeviceinformation. devicetype = devicetype. reference;
E. graphicsdeviceinformation. presentationparameters. multisampletype = multisampletype. None;
}
Run F5 and prompt me directly,
Error 2: the current context does not contain the name "createoptions" E: "windowsgame1" windowsgame1 "game1.cs 27 67 windowsgame1
I searched the internet and found that this method has been removed, commented out and compiled,
F5 execution, prompt
Cocould not find a direct3d device that has a Direct3D9-level driver and supports pixel shader 1.1 or greater.
Dizzy, isn't it back to the origin,
Later debugging found that this method does not seem to be executed. Why not? I am not interested in researching any more. Now I just want to run a window!
I finally found a good thing on a foreign website,
Referencegraphicsdevicemanager
This problem can be basically solved. Create a referencegraphicsdevicemanager class, replace graphicsdevicemanager with the handler class, compile it again, and report an error. When writing this class, the author of xna2.0 should not output it yet, so this time it was all some version errors. After one modification, it was compiled and F5 was run...
Upload the code and hope to have a good table joke. If this article is helpful to you, it is a great honor,
In this process, I only acted as a finder role. Some things are still in the learning stage. Let's make progress together!
/Files/Kkun/referencegraphicsdevicemanager.rar