Book Image

Visual Studio 2012 Cookbook

By : Richard Banks
Book Image

Visual Studio 2012 Cookbook

By: Richard Banks

Overview of this book

<p>There’s a new technology wave coming, and for Microsoft this is reflected in Windows 8, HTML5 web development, .NET 4.5 and C++11. Riding that wave is a new version of their flagship development tool, Visual Studio 2012, and "Visual Studio 2012 Cookbook" has you putting the new features into practice from the get-go! <br /><br />Among the exciting new features of Visual Studio 2012 is support for Windows 8, HTML5 and asynchronous development, as well as Team Foundation Server 2012 integration. “Visual Studio 2012 Cookbook” doesn’t waste time explaining what you already know from prior Visual Studio versions; instead you’ll see targeted and focused recipes on only new features so that you can get up to speed and back to work faster.<br /><br />“Visual Studio 2012 Cookbook” empowers you to take advantage of all the new features in Visual Studio 2012 so that you can develop applications for the next technology wave.</p> <p>The task-based recipes in this guide will have you up and running with improvements like support for Windows 8 development, HTML5 and JavaScript, .NET 4.5, asynchronous code and C++11.</p> <p>And since most people don’t develop alone, you’ll also see how the new team development features of Visual Studio 2012 and Team Foundation Server 2012 can help your whole team work smarter, not harder.<br /><br />Time is short and you’re in a hurry, so “Visual Studio 2012 Cookbook” will help you discover what’s new by way of a simple recipe format that is quick and easy to digest.</p>
Table of Contents (17 chapters)
Visual Studio 2012 Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the graphics tools


The graphics tools in previous versions of Visual Studio might best be described as mediocre. However, in Visual Studio 2012 they have been revisited to provide some much needed updates.

Visual Studio 2012 in no way replaces a full featured graphics package, however if you just need to tweak an image or make some simple changes then Visual Studio can be very useful.

In this recipe, you'll create an image that you could use in the website project we've been using throughout this chapter.

Getting ready

Open the VS2010_Web project that we've been working with throughout this chapter.

How to do it...

  1. Right-click on the VS2010_Web project and select Add | New Folder. Call the new folder Images.

  2. With the Images folder selected, from the File menu choose New File or press Ctrl+N. From the New File dialog select Graphics | PNG Image (.png) and click on Open.

    The new Visual Studio Graphics Designer will appear.

  3. Save the image to the Images folder of your project using File | Save As with the default name of Image1.png.

  4. In Solution Explorer turn on the Show all files option and locate the image you just saved to the Images folder. Include it in the project by right-clicking it and choosing the Include In Project option.

  5. Back in Graphics Designer you will see two new toolbars. One along the top of the image area and one along the side. For reference we will call these toolbars the top toolbar and the side toolbar.

  6. Select the Brush tool so you can draw on your wonderfully blank picture.

    To set the color of the brush, ensure the Properties panel is open. If it isn't it can be accessed by pressing F4 or choosing View | Properties Window.

  7. To select the brush thickness change the Width property of Appearance to a value of your choice, such as 10.

  8. Now draw on the canvas and start creating your next masterpiece! Experiment with the other options in the toolbar to get a feel for what the graphics tool provides. Just make sure you produce something better than this horrible effort!!

How it works...

The new graphics designer is a DirectX accelerated design surface. You can alter the DirectX rendering output method to use software acceleration if, for example, you are using older hardware and are seeing graphics glitches. To switch, use the side toolbar and select Advanced | Graphics Engines | Render with D3D11WARP.

While the graphics editor is a much better editor that the previous resource editor, and even though DirectX acceleration means that the image editor can now work with very large, and complex images and a multitude of formats, it still isn't a match for a full featured graphics editing program. For advanced graphics needs, use a specialist tool.

There's more...

Visual Studio 2012 doesn't simply provide the same 2D image editing options of the past with a new interface; it now provides for some more advanced techniques specifically designed for those who need to produce visually rich applications such as games or information visualization tools.

MIP mapping support

MIP mapping is a technique used in video games for texture mapping 3D models. A single image file is structured to contain a high resolution texture as well as multiple versions of the same texture at lower levels of resolution. When the game is running, a texture of the appropriate resolution is extracted from the image file and applied to the 3D model based on the distance the model is from the camera. The further away the object, the lower the resolution chosen.

Visual Studio 2012 supports the editing of MIP map images using the new Graphics Designer.

3D Model support

You may have noticed when you were creating the PNG file that you also had the option to create a 3D scene.

Visual Studio 2012 supports the viewing, editing, and creating of AutoDesk FBX files, and also supports the viewing and editing (but not creating) of OBJ and Collada DAE files.

Pixel shaders

Visual Studio now supports the creating of pixel shaders in a visual manner using DGSL (Directed Graph Shader Language) as well as HLSL shaders using C++.

See also

  • The Creating a shader using DGSL recipe in Chapter 7,Unwrapping C++ Development

  • The Creating and displaying a 3D model recipe in Chapter 7,Unwrapping C++ Development