【发布时间】:2015-02-20 21:05:30
【问题描述】:
在this tutorial 之后,我正在对 3D 场景执行阴影映射。现在我想要 在之前操作 shadowMapTexture 的原始纹素数据(请参阅下面的摘录) 使用 ARB 扩展来应用它
//Textures
GLuint shadowMapTexture;
...
...
**CopyTexSubImage2D** is used to copy the contents of the frame buffer into a
texture. First we bind the shadow map texture, then copy the viewport into the
texture. Since we have bound a **DEPTH_COMPONENT** texture, the data read will
automatically come from the depth buffer.
//Read the depth buffer into the shadow map texture
glBindTexture(GL_TEXTURE_2D, shadowMapTexture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowMapSize, shadowMapSize);
- 注意我只使用 OpenGL 2.1。
【问题讨论】:
-
你到底想知道什么?
-
如何修改 CopyTexSubImage2D 的纹素例如数据[i] = 数据[i]*beta[i]。其中 beta[i] 是一个外部调制函数。
-
我们在谈论什么样的修改?您正在使用的教程是ancient。现在,我们直接渲染成纹理,根本不需要这样的副本。可以通过简单地再次渲染到纹理中来修改数据,或者添加一些基于着色器的后处理通道,具体取决于要应用的修改类型。
-
我明白了!首先我需要 glGetTexImage() 来获取数据。 link。谢谢大家!
标签: c++ opengl texture2d shadow-mapping