use of org.lwjgl.opengl.GL13 in project GregTech by GregTechCEu.
the class BloomEffect method renderUnreal.
public static void renderUnreal(Framebuffer highLightFBO, Framebuffer backgroundFBO) {
cleanUP(backgroundFBO.framebufferWidth, backgroundFBO.framebufferHeight);
// blur all mips
int[] kernelSizeArray = new int[] { 3, 5, 7, 9, 11 };
highLightFBO.bindFramebufferTexture();
for (int i = 0; i < BUFFERS_D.length; i++) {
Framebuffer buffer_h = BUFFERS_D[i];
int kernel = kernelSizeArray[i];
Shaders.renderFullImageInFBO(buffer_h, Shaders.S_BLUR, uniformCache -> {
uniformCache.glUniform2F("texSize", buffer_h.framebufferWidth, buffer_h.framebufferHeight);
uniformCache.glUniform2F("blurDir", step, 0);
uniformCache.glUniform1I("kernel_radius", kernel);
}).bindFramebufferTexture();
Framebuffer buffer_v = BUFFERS_U[i];
Shaders.renderFullImageInFBO(buffer_v, Shaders.S_BLUR, uniformCache -> {
uniformCache.glUniform2F("texSize", buffer_v.framebufferWidth, buffer_v.framebufferHeight);
uniformCache.glUniform2F("blurDir", 0, step);
uniformCache.glUniform1I("kernel_radius", kernel);
}).bindFramebufferTexture();
}
// composite all mips
for (int i = 0; i < BUFFERS_D.length; i++) {
GlStateManager.setActiveTexture(GL13.GL_TEXTURE0 + i);
GlStateManager.enableTexture2D();
BUFFERS_U[i].bindFramebufferTexture();
}
Shaders.renderFullImageInFBO(BUFFERS_D[0], Shaders.COMPOSITE, uniformCache -> {
uniformCache.glUniform1I("blurTexture1", 0);
uniformCache.glUniform1I("blurTexture2", 1);
uniformCache.glUniform1I("blurTexture3", 2);
uniformCache.glUniform1I("blurTexture4", 3);
uniformCache.glUniform1I("blurTexture5", 4);
uniformCache.glUniform1F("bloomStrength", strength);
uniformCache.glUniform1F("bloomRadius", 1);
});
for (int i = BUFFERS_D.length - 1; i >= 0; i--) {
GlStateManager.setActiveTexture(GL13.GL_TEXTURE0 + i);
GlStateManager.bindTexture(0);
}
blend(BUFFERS_D[0], backgroundFBO);
}
Aggregations