A DDS file is a container for all kinds of Direct3D resources including 1D and 2D textures, cubemaps, volume maps, arrays of 1D or 2D textures or cubemaps each optionally with mipmaps. Rather than use a PNG and the Windows Imaging Component (WIC) to load the texture, a more efficient thing for us to do is to make use of a DDS file instead. M_spriteBatch-> Draw(m_texture.Get(), m_screenPos, nullptr,īuild and run again, and you'll get a nice clean cat: M_spriteBatch-> Begin(SpriteSortMode_Deferred, m_states-> NonPremultiplied()) In the Game.h file, add the following variable to the bottom of the Game class's private declarations: Start by saving cat.png into your new project's directory, and then from the top menu select Project / Add Existing Item. In Direct3D 11, these are distinct objects to allow for different interpretations of the same resource data (such as an array of 2D textures or a cubemap).Ī sampler state object which describes how the GPU should handle various aspects of reading the texture data for rendering (such as image filtering and/or tiling of the bitmap).Ī blend state object which indicates how the GPU should combine existing information in the render target with the texture data.Īdditional Direct3D objects are also required ( vertex buffer, index buffer, rasterizer state object, input layout, vertex shader, pixel shader, and constant buffer), but in this tutorial these are handled by SpriteBatch. In older versions of Direct3D, the texture resource and shader resource view (SRV) were combined into a single interface. The shader resource view which describes the properties of the texture resource. For Direct3D, this requires making use of:Ī 2D texture resource which is a surface containing the bitmap image pixel data. BackgroundĪ sprite is a bitmap rendered at some location on the screen. Setupįirst create a new project using the instructions from the previous lessons: Using DeviceResources andĪdding the DirectX Tool Kit which we will use for this lesson. In this lesson, we will cover the basics of creating a texture from a bitmap file, and then rendering it using a 2D sprite with various drawing options.
0 Comments
Leave a Reply. |