In DirectX 12 the application is responsible for managing video memory, including uploading resources from 'shared memory' to 'dedicated video memory'. You should set a break-point on CreateWICTextureFromFile and step into the code to find the exact problem. If you get a runtime exception, then you may have the "cat.png" in the wrong folder, have modified the "Working Directory" in the "Debugging" configuration settings, or otherwise changed the expected paths at runtime of the application. In the Game.h file, add the following variable to the bottom of the Game class's private declarations (right after the m_graphicsMemory variable you already added as part of setup):īuild and run the application which will still not be displaying anything but the cornflower blue window, but will have a texture loaded. Start by saving cat.png into your new project's directory, and then from the top menu select Project / Add Existing Item. Some additional Direct3D objects are also required for uploading the texture data (upload heap committed resource, fence, command allocator, and command list) but in this tutorial these are handled by ResourceUploadBatch.įinally, some 'in-flight' memory related to constant buffer views and dynamic vertex buffers are also required, and these are managed by GraphicsMemory. This can be a static sampler in the root signature or a heap sampler referenced in a sampler descriptor heap.Īdditional Direct3D objects are also required for drawing ( vertex buffer, index buffer, pipeline state object, and root signature), but in this tutorial these are handled by SpriteBatch. The shader resource view descriptor created in a resource descriptor heap which describes the properties of the texture resource.Ī sampler 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). For Direct3D, this requires making use of:Ī committed resource which is the texture containing the bitmap image pixel data for rendering. 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |