int main(int argc, const char* argv[]) {
if (!initOpenGLWindow()) {
glfwTerminate();
return 1;
}
glfwSetCursorPosCallback(glWindow, mouseCallback);
glfwSetInputMode(glWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
initQuadScreenVertices();
initOpenGLState();
initObjects();
initShaders();
initUniforms();
initFrameBuffer();
initSnowFlakeData(); //VERY IMPORTANT
initSnowflakes();
while (!glfwWindowShouldClose(glWindow)) {
// first pass
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // we're not using the stencil buffer now
glEnable(GL_DEPTH_TEST);
//Here are my rendering functions for my object scene, will ignore
// second pass
glBindFramebuffer(GL_FRAMEBUFFER, 0); // back to default
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
screenFrame.useShaderProgram();
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, textureColorbuffer[1]);
Подробнее здесь: [url]https://stackoverflow.com/questions/79201125/i-would-need-some-insight-into-mrt-and-color-channel-binding[/url]
Я пытаюсь выяснить, что может быть не так с моей настройкой. Вот код: [code]void initFrameBuffer() { glGenFramebuffers(1, &framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, 0); } [/code] Простая инициализация кадрового буфера, экземпляр которой будет создан в следующей основной функции: [code]int main(int argc, const char* argv[]) {
if (!initOpenGLWindow()) { glfwTerminate(); return 1; }
initSnowFlakeData(); //VERY IMPORTANT initSnowflakes();
while (!glfwWindowShouldClose(glWindow)) {
// first pass glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // we're not using the stencil buffer now glEnable(GL_DEPTH_TEST);
//Here are my rendering functions for my object scene, will ignore
// second pass glBindFramebuffer(GL_FRAMEBUFFER, 0); // back to default glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);