这可能是一个愚蠢和琐碎的问题,但由于我对OpenGL比较新,我不明白如何将来自单个FBO的颜色缓冲区和深度缓冲区发送到片段着色器。
我的FBO生成了1个纹理缓冲区和1个深度缓冲区。
glGenTextures(1, &texture_color);
glBindTexture(GL_TEXTURE_2D, texture_color);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glGenTextures(1, &texture_depth);
glBindTexture(GL_TEXTURE_2D, texture_depth);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);
and I would like, in my fragment buffer to have
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
需要同时填充颜色和深度纹理...
我可以使用GlBindtexture只发送其中一个,而且效果很好,但是我无法同时发送两个。是否有人知道如何做到这一点?
谢谢!