检索gl_FragColor的值

时间:2013-05-20 16:19:40

标签: c++ opengl-es opengl-es-2.0

这个网站(GPGPU programming with OpenGL ES 2.0)谈论如何使用opengl es2.0来做gpgpu 我的问题是如何检索价值 gl_FragColor回到cpu站点(主机)?

片段着色器

varying vec2 fragTexCoord;

void main() {        
    gl_FragColor = texture2D(tex, fragTexCoord);
}

cpu site

 //.......
    glDrawArrays(GL_TRIANGLES, 0, 3);

  //How could I get the value after draw?

1 个答案:

答案 0 :(得分:2)

  

我的问题是如何将gl_FragColor的值检索回cpu站点(主机)?

glReadPixels()