• <small id='EC2OR'></small><noframes id='EC2OR'>

  • <tfoot id='EC2OR'></tfoot>

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

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

        glReadPixels() “数据"参数用法?

        时间:2023-09-17

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

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

                <tbody id='S4F0h'></tbody>
              • <legend id='S4F0h'><style id='S4F0h'><dir id='S4F0h'><q id='S4F0h'></q></dir></style></legend>
                <tfoot id='S4F0h'></tfoot>
                <i id='S4F0h'><tr id='S4F0h'><dt id='S4F0h'><q id='S4F0h'><span id='S4F0h'><b id='S4F0h'><form id='S4F0h'><ins id='S4F0h'></ins><ul id='S4F0h'></ul><sub id='S4F0h'></sub></form><legend id='S4F0h'></legend><bdo id='S4F0h'><pre id='S4F0h'><center id='S4F0h'></center></pre></bdo></b><th id='S4F0h'></th></span></q></dt></tr></i><div id='S4F0h'><tfoot id='S4F0h'></tfoot><dl id='S4F0h'><fieldset id='S4F0h'></fieldset></dl></div>

                  本文介绍了glReadPixels() “数据"参数用法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 glReadPixels 从图像中获取颜色数据.我应该使用 glReadPixels 但我似乎无法弄清楚.这是一个更大项目的一部分,但现在我只想知道如何正确使用它.

                  I'm trying to use glReadPixels to get color data from an image. I'm supposed to be using glReadPixels but I can't seem to figure it out. It's part of a much larger project, but right now all I want is to know how to properly use this.

                  我查了一下,结果是这样的:

                  I looked it up and got something like this:

                      void glReadPixels(GLint x, 
                         GLint y, 
                         GLsizei width, 
                         GLsizei height, 
                         GLenum format, 
                         GLenum type, 
                         GLvoid* data);
                  

                  但我不确定我应该把什么作为最后一个论点,当我这样做时,我什至会如何使用它.帮助将不胜感激!(即:如何使用它或如何获取颜色的简单示例)

                  But I'm not sure what I should be putting in as that last argument, and when I do, how I would even use it. Help would really be appreciated! (ie: a simple example of how to use it, or how to get the color)

                  推荐答案

                  data 接受一个指向您为 glReadPixels 准备将数据放入的缓冲区的指针.像这样:

                  data takes a pointer to some buffer you prepared for glReadPixels to put the data into. Like this:

                  switch(format) {
                  case GL_BGR:
                  case GL_RGB:
                      components = 3; break;
                  
                  case GL_BGRA:
                  case GL_RGBA:
                      components = 4; break;
                  
                  case GL_ALPHA:
                  case GL_LUMINANCE:
                      components = 1; break;
                  }
                  
                  GLubyte *data = malloc(components * width * height);
                  if( data ) {
                      glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, data);
                  }
                  

                  这篇关于glReadPixels() “数据"参数用法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何将屏幕上的鼠标坐标转换为 3D 坐标 下一篇:gpu蒙皮的矩阵计算

                  相关文章

                  最新文章

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

                  2. <small id='sumKc'></small><noframes id='sumKc'>

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