Game Development Reference
In-Depth Information
for each image or data stream will vary based on the data formats that you have
configured during initialization, but this general process allows the developer to
easily access all of the stream-based data that the Kinect runtime makes available.
For example, instead of receiving an INuiFrameTexture pointer, when working
with the skeletal information the application will access an NUI_SKELETON_FRAME
structure. Further examples of reading out each type of data can be found in the
example program.
2.4.2 Direct3D 11 Resource Selection
Once the data streams of the Kinect are accessible to our application, we have
to do something with the data that they carry. In order to use this data with
Direct3D 11, we must first select an appropriate Direct3D 11 resource to house
the data streams for us. In general, Direct3D 11 requires us to follow a particular
sequence when updating a resource with data from the CPU. Resources must
be created with the specification of their intended “usage.” This usage indicates
how the resource will be read from and/or written to by the application. Since
the resources will be written to by the CPU and read by the GPU, this means
that we need to perform a two-step update process. First the CPU will update
a staging resource, which is then followed by copying the contents of the staging
resource to an additional default usage resource. (See Figure 2.7.) This second
resource is then accessible for reading within the programmable pipeline stages
of the GPU.
In addition to choosing the usage options of our resources, we also need to
decide what type of resource would make the most sense for holding the desired
data. In general, the type of resource will be dictated by the way that an ap-
plication will be using the Kinect data. For our two image-based data streams,
a natural first choice for holding each frame would be a texture resource. These
textures would be created with their own appropriate formats for the data that
they are holding, but accessing their contents would be fairly intuitive.
Lock
Kinect
Frame
Copy to
Staging
Resource
Copy to
Default
Resource
Event
“Frame Ready”
Figure 2.7. The process of acquiring data from the Kinect runtime and using it in the
GPU.
 
Search Nedrilad ::




Custom Search