|
看了一个opengl写的教程,里面有如下代码:
- for (int order = 2; order <= 4; ++order)
- {
- // computes deltaJ (line 7 in algorithm 4.1)
- glFramebufferTextureEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, deltaJTexture, 0);
- glViewport(0, 0, DataDef::RES_MU_S_32 * DataDef::RES_NU_8, DataDef::RES_MU_128);
- glUseProgram(jProg);
- glUniform1f(glGetUniformLocation(jProg, "first"), order == 2 ? 1.0 : 0.0);
- glUniform1i(glGetUniformLocation(jProg, "transmittanceSampler"), DataDef::transmittanceUnit_1);
- glUniform1i(glGetUniformLocation(jProg, "deltaESampler"), DataDef::deltaEUnit_4);
- glUniform1i(glGetUniformLocation(jProg, "deltaSRSampler"), DataDef::deltaSRUnit_5);
- glUniform1i(glGetUniformLocation(jProg, "deltaSMSampler"), DataDef::deltaSMUnit_6);
- for (int layer = 0; layer < DataDef::RES_R_32; ++layer)
- {
- DataDef::setLayer(jProg, layer);
- drawQuad();
- }
- }
复制代码
这个教程内容我想用osg实现,setLayer函数里面是对shader传递参数的过程,这段难道我要写order = {2,3,4} 的三个视口相同attach到一个纹理的相机吗? |
|