索引缓冲区Index buffers

索引缓冲区是包含索引数据的内存缓冲区,索引数据是到顶点缓冲区的整数偏移量,用于渲染基元。Index buffers are memory buffers that contain index data, which are integer offsets into vertex buffers, used to render primitives.

索引缓冲区是包含索引数据的内存缓冲区。Index buffers are memory buffers that contain index data. 索引数据或索引是到顶点缓冲区的整数偏移量,用于渲染基元。Index data, or indices, are integer offsets into vertex buffers and are used to render primitives.

顶点缓冲区包含顶点;因此,你可以绘制包含或不包含索引基元的顶点缓冲区。A vertex buffer contains vertices; therefore, you can draw a vertex buffer either with or without indexed primitives. 但是,由于索引缓冲区包含索引,因此不能使用没有对应顶点缓冲区的索引缓冲区。However, because an index buffer contains indices, you cannot use an index buffer without a corresponding vertex buffer.

索引缓冲区说明Index Buffer Description

索引缓冲区在功能方面进行描述,例如其存在于内存中的位置、其是否支持读取和写入以及其能够包含的索引的类型和数量。An index buffer is described in terms of its capabilities, such as where it exists in memory, whether it supports reading and writing, and the type and number of indices it can contain.

索引缓冲区描述用于告知应用程序现有的缓冲区是如何创建的。Index buffer descriptions tell your application how an existing buffer was created. 你提供一个空描述结构,以便系统填充之前创建的索引缓冲区的能力。You provide an empty description structure for the system to fill with the capabilities of a previously created index buffer.

索引处理要求Index Processing Requirements

索引处理操作的性能很大程度上取决于索引缓冲区存在于内存中的位置,以及所用的是何种类型的渲染设备。The performance of index processing operations depends heavily on where the index buffer exists in memory and what type of rendering device is being used. 应用程序在创建索引缓冲区时控制其内存分配。Applications control the memory allocation for index buffers when they are created.

应用程序可以直接将索引写入到在驱动程序优化存储器中分配的索引缓冲区。The application can directly write indices to a index buffer allocated in driver-optimal memory. 这种技术可以避免后来进行冗余的复制操作。This technique prevents a redundant copy operation later. 如果你的应用程序从索引缓冲区读回数据,则此技术无法正常工作,因为宿主从驱动程序优化存储器执行读取操作可能会非常缓慢。This technique does not work well if your application reads data back from an index buffer, because read operations done by the host from driver-optimal memory can be very slow. 因此,如果你的应用程序需要在处理期间读取或将数据不规律地写入缓冲区,则系统内存索引缓冲区是更好的选择。Therefore, if your application needs to read during processing or writes data to the buffer erratically, a system-memory index buffer is a better choice.

相关主题Related topics

顶点和索引缓冲区Vertex and index buffers