开发者

Does my usecase require XNA or can I use silverlight (Windows Phone 7)?

I'm new to .net programming in general and windows phone 7 specifically (I'm a Java guy).

I'm writing an application for a windows phone 7 workshop in my university which has a semi augmented reality mode. (semi because win-pho7 does not allow the camera feed).

Mainly I will need to render overlay of various images across a background (which should have been the camera feed) as a result of pitch, yaw and gps changes (which I subs开发者_运维百科cribe to).

I'm trying to understand whether I need to use XNA, as this seems to me as a graphics demanding task and that is what we were explained XNA is for, or I can use silverlight which seems a bit more simple to develop for with the draggabale controls and all.

I hope my question makes since, if not please ask and I'll supply more clarifications.

Thanks,

Ittai

Update:

I'm mainly trying to understand if rendering around 20 2D images, which will be re-rendered based on the above events, is something silverlight can handle or does it require xna (as it is too demanding graphics wise)?

If someone has experience with these issues I'd like to hear.

Last update (hopefully):

The main thing I'm concerned with is silverlight's ability to handle the screen refreshing, sort of speak.

Seeing as this is an augmented reality application and whenever the user moves the phone I need to adjust the overlayed images, nothing complicated just move them a few pixel offsets up/down/left/right but still there is something to be done.

I'm concerned that trying to apply those small but frequent changes to the images will turn out to be a problem? And seeing as these are two different implementation paths I don't think this qualifies as premature optimization.

As I think you can easily understand I'd rather user silverlight I'm just not sure it can handle it.

Thanks a lot for reading all the updates,

Ittai


I have the same doubt. I believe WPF/Silverlight is better than XNA because of high level of code. We have a lot of controls there, which XNA don't have one. I am actually creating a game in WPF. But I have to advance more. Well, this link could help you: What limitations does WPF have comparing to XNA?

If you think that you will need more performance at rendering, then my suggestion is to use XNA.


Personally I'd opt for Silverlight unless you need something specific to XNA.

XNA specific functionality being:

  • rendering of 3D images
  • making sense to run in a game loop and having a constantly changing screen (rather than directly responding to occassional user events.)
  • needing to do do lots of custom, fine-grained image manipulations.

It's the last one that may make XNA seem like the one to go for but if you're just overlaying predefined images or polygons I'd stick with Silverlight.

The number of images shoudln't be an issue as long as they're not large with lots of overlaps.

Disclaimer (which should be considered in light of any potential bias): I have much more Silverlight experience than I do with XNA. I wouldn't be surprised if someone with more XNA and less Silverlight experience saw this differently.


I agree with the previous answers, and with your assessment of "premature optimization":

  1. Silverlight is more than capable of doing what you require: we've seen it do 60FPS with graphics on it, on the device
  2. XNA will give an edge with 3D graphics, rather than 2D

Important points to notice:

  • I think the has an FPS count on the side. But even if it does, you'd gain by putting one of your own there for debug-node, which can be used on a real phone later. This wll quickly give you a feel of how fast you can render
  • Be sure to use "BitmpaCache" on your canvas. See here for more info: http://www.andybeaulieu.com/Default.aspx?EntryID=196&tabid=67 on WP7 perfomance and here: (same domain)/Home/tabid/67/EntryID/144/Default.aspx on Bitmap Caching.
  • Try the "pitch/yaw" APIs, lookup some info on them, lookup about thresholds for them. The data you'll get from them probably won't be very accurate, so put some more thinking on this area, rather than Silverlight perf :)
  • I'm not sure GPS updates will help you much, since it's probably too crude

Good luck!

Eyal


I would say you could use either to do your job of manipulating 2D images. Both have APIs capable of this and both are capable of dealing with performance issues that arise on the resource constrained devices.

What you can look at is what unique capabilities each brings to the table that you might want to use.

Silverlight brings controls to the table. If you're taking user input and displaying things other than your images, this may be an important consideration for you. As it stands XNA is only just starting to get some community developed support to fill this hole.

XNA brings 3D graphics APIs and support for mathematical calculations often made in graphics intensive applications (such as games) like Vectors, Matrices, Planes, Rays, Bounding Types, Intersections in 3D space.

You can also look at your current skill set to see which will give you a shorter learning curve.

I would imagine your Java experience has been with platform features (like UI controls) that are more similar to Silverlight than XNA, but that is an assumption.

I've implemented rendering of 3D objects with Textures and Ray Tracing onto 2D images using C with no Graphics API support a long time ago while I was at Uni, it's possible you could have done the same in Java. That kind of project would have been a lot easier with the support of an API like XNA.

edit: WRT to your last update, these kind of transformations can be handled on the render thread (gpu) using silverlight just as texture animations done using XNA APIs would be passed off to the gpu thread. I would recommend doing some performance tests on picture animations first just to verify you're not going to hit any surprises after diving in too far.

If you felt so inclined you could duplicate the demo using XNA to compare and see if there are any noteable differences in the efficiency of firing off multiple animations. Each individual animation though I'm sure would peform comparably.


In terms of development time, silverlight will be faster and more productive. If you go with xna you will spend a lot of time implementing controls or functionality that are provided out of the box with silverlight.

In terms of performance. XNA gives you more control and better performance.

You can also mix them together. I developed a wp7 game where i call XNA api's to handle the audio, because it's much easier than silverlight.

I guess the best solution would be to make your app with silverlight, and call XNA api's to handle the more graphic intensive requirements, if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜