• <bdo id='hkZWR'></bdo><ul id='hkZWR'></ul>

    1. <small id='hkZWR'></small><noframes id='hkZWR'>

    2. <legend id='hkZWR'><style id='hkZWR'><dir id='hkZWR'><q id='hkZWR'></q></dir></style></legend>
      <tfoot id='hkZWR'></tfoot>

      1. <i id='hkZWR'><tr id='hkZWR'><dt id='hkZWR'><q id='hkZWR'><span id='hkZWR'><b id='hkZWR'><form id='hkZWR'><ins id='hkZWR'></ins><ul id='hkZWR'></ul><sub id='hkZWR'></sub></form><legend id='hkZWR'></legend><bdo id='hkZWR'><pre id='hkZWR'><center id='hkZWR'></center></pre></bdo></b><th id='hkZWR'></th></span></q></dt></tr></i><div id='hkZWR'><tfoot id='hkZWR'></tfoot><dl id='hkZWR'><fieldset id='hkZWR'></fieldset></dl></div>
      2. OpenGL 什么时候完成函数中的指针?

        时间:2023-09-18
        • <bdo id='76iFJ'></bdo><ul id='76iFJ'></ul>
          <tfoot id='76iFJ'></tfoot>
          1. <i id='76iFJ'><tr id='76iFJ'><dt id='76iFJ'><q id='76iFJ'><span id='76iFJ'><b id='76iFJ'><form id='76iFJ'><ins id='76iFJ'></ins><ul id='76iFJ'></ul><sub id='76iFJ'></sub></form><legend id='76iFJ'></legend><bdo id='76iFJ'><pre id='76iFJ'><center id='76iFJ'></center></pre></bdo></b><th id='76iFJ'></th></span></q></dt></tr></i><div id='76iFJ'><tfoot id='76iFJ'></tfoot><dl id='76iFJ'><fieldset id='76iFJ'></fieldset></dl></div>
              <tbody id='76iFJ'></tbody>

                • <legend id='76iFJ'><style id='76iFJ'><dir id='76iFJ'><q id='76iFJ'></q></dir></style></legend>

                  <small id='76iFJ'></small><noframes id='76iFJ'>

                  本文介绍了OpenGL 什么时候完成函数中的指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  OpenGL 有许多直接接受指针的函数.其中一些从这些指针读取数据,其他将数据写入这些指针.

                  OpenGL has a number of functions that directly take pointers. Some of them read data from those pointers, others write data to those pointers.

                  然而,OpenGL 函数通常不会立即执行.通常,当您绘制某些东西时,绘制需要一段时间才能完成.

                  However, OpenGL functions often don't execute immediately. Usually, when you draw something, it takes a while for the drawing to finish.

                  那么我怎么知道 OpenGL 何时完成了我给它的指针?

                  So how do I know when OpenGL is finished with a pointer I give it?

                  推荐答案

                  所有 OpenGL 函数,除了下面提到的例外,都将使用您在该函数返回时提供的任何指针来完成.所以 glReadPixels 返回时将完成所有像素读取和格式转换.这就是异步像素传输对于读取操作如此重要的原因.它允许 OpenGL 这样做,不与 GPU 同步.

                  All OpenGL functions, with the exception noted below, will be finished with any pointer you give it upon that function's return. So glReadPixels will have finished all pixel reading and format conversion upon its return. This is why asynchronous pixel transfer is so important for reading operations. It allows OpenGL to not do that, to not synchronize with the GPU.

                  此规则的唯一例外是每个以指针"一词结尾的函数.诸如 glVertexAttribPointerglTexCoordPointer 之类的东西.当您将客户端内存与这些函数(在核心配置文件 OpenGL 3.2+ 中不再合法)一起使用时,这些函数会存储一个指向该内存的指针.因此,只要您打算使用这些顶点属性进行渲染,就必须确保该指针有效.

                  The only exception to this rule is every function that ends in the word "Pointer". Things like glVertexAttribPointer, glTexCoordPointer, and the like. When you use client-side memory with these functions (no longer legal in core profile OpenGL 3.2+), these functions store a pointer to that memory. Therefore, you must ensure that this pointer is valid for as long as you intend to render with those vertex attributes.

                  在使用客户端内存的每次渲染调用之后,OpenGL 要求实现在渲染函数返回时完成从客户端内存的读取.所以你可以调用glDrawArrays,然后删除有问题的指针.只要您在更改这些指针之前不进行另一个绘制调用,就可以了.这意味着 OpenGL 必须在渲染调用返回时复制出所有相关的顶点数据(使用缓冲区对象更快的原因之一).

                  After each rendering call using client-memory, OpenGL requires that the implementation have finished reading from client memory by the time the rendering function returns. So you can call glDrawArrays, then delete the pointers in question. And as long as you don't make another draw call until you've changed those pointers, you're fine. This means OpenGL has to have copied out all relevant vertex data by the time the rendering call returns (one of the reasons why using buffer objects is faster).

                  这篇关于OpenGL 什么时候完成函数中的指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:OpenGL - 鼠标坐标到空间坐标 下一篇:如何根据 Wavefront (.obj) 文件中给出的纹理索引对

                  相关文章

                  最新文章

                  <legend id='Vcgk1'><style id='Vcgk1'><dir id='Vcgk1'><q id='Vcgk1'></q></dir></style></legend>

                    <i id='Vcgk1'><tr id='Vcgk1'><dt id='Vcgk1'><q id='Vcgk1'><span id='Vcgk1'><b id='Vcgk1'><form id='Vcgk1'><ins id='Vcgk1'></ins><ul id='Vcgk1'></ul><sub id='Vcgk1'></sub></form><legend id='Vcgk1'></legend><bdo id='Vcgk1'><pre id='Vcgk1'><center id='Vcgk1'></center></pre></bdo></b><th id='Vcgk1'></th></span></q></dt></tr></i><div id='Vcgk1'><tfoot id='Vcgk1'></tfoot><dl id='Vcgk1'><fieldset id='Vcgk1'></fieldset></dl></div>
                  1. <tfoot id='Vcgk1'></tfoot>

                    1. <small id='Vcgk1'></small><noframes id='Vcgk1'>

                        <bdo id='Vcgk1'></bdo><ul id='Vcgk1'></ul>