Windows Phone 7 Development tutorial (2)--windows phone XNA 4.0 3D game development

Source: Internet
Author: User
Tags visual studio visual studio 2010

Program code compilation Environment Visual Stuido, Windows Phone 7 SDK, XNA 4.0 Game Studio, download link:

Http://files.cnblogs.com/aawolf/XNA_aawolf_3D.rar

Have a little free time today, looking at the development of Windows Phone 7. See the Silverlight for phone and XNA 4.0 Development article has been a lot, and high quality. Let me just say that XNA 4.0 3D is a field that has something to do with the current job, and XNA 4.0 's class library is designed very well, a notch higher than the iphone and Android Opengles class library. After learning 3D development, using the XNA Class Library is also a good choice, and Windows Phone Simulator support for 3D is also very good. The only regret is that Windows phone does not support 3D development for C + +.

If you're a friend of the XNA 3.1 development on Zune, you may recall that 3D was not supported in XNA 3.1, and the 3D support classes added in XNA 4.0 are mainly included in the Microsoft.Xna.Framework.Graphics namespace. If the 3D concept in XNA 4.0 is very similar to opengles, we can find many corresponding functions, methods, and so on, in a sense, XNA 4.0 3D support is for Opengles 2.0 encapsulation.

A. A simple 3D program

Let's start with a simple 3D program that was originally introduced in the link below.

Http://msdn.microsoft.com/en-us/library/bb203926.aspx

However, when porting to Windows Phone 7, there are some minor problems, some documentation problems, some interface changes. How to create a XNA 4.0 project in Visual Studio 2010 No more, you can refer to my "Windows phone development tool experience", which links as follows:

Http://www.cnblogs.com/aawolf/archive/2010/08/28/1811438.html

XNA 4.0 program is derived from Microsoft.Xna.Framework.Game class, developers need to overload the game Four methods: Initialize (initialization), loadcontent (load content), Methods such as unloadcontent (uninstall content), update (update), and Draw (drawing).

First, we add some of the required private variables to the Game1 class:

Matrix Worldmatrix;

Matrix Viewmatrix;

Matrix ProjectionMatrix;

Vertexpositionnormaltexture[] cubevertices;

Vertexdeclaration vertexdeclaration;

VertexBuffer VertexBuffer;

Basiceffect Basiceffect;

Martrix's Chinese name is "Matrix", and there is a translation called "The Hacker Empire" ... Pull it off, what is a matrix? We do not explain, as long as we know that the matrix is all the basis of 3D linear changes can be. We don't know what the matrix is, but we're in it. In the Game1 class, three matrices are used: Worldmatrix to describe the world coordinate system, Viewmatrix to describe the camera coordinate system, and ProjectionMatrix to describe the projection coordinate system. These are the 3D graphics concepts that are not explained.

The other two important variables are vertexbuffer and basiceffect. The VertexBuffer contains a series of vectors that form the vertices of the squares we want to display; Basiceffect describes a base rendering effect that describes basic elements such as coordinate systems, colors, and lights, which are the basis for 3D graphical display.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.