Search in sources :

Example 1 with GL13

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);
}
Also used : Side(net.minecraftforge.fml.relauncher.Side) RenderUtil(gregtech.client.utils.RenderUtil) GlStateManager(net.minecraft.client.renderer.GlStateManager) GL13(org.lwjgl.opengl.GL13) PingPongBuffer(gregtech.client.shader.PingPongBuffer) GL11(org.lwjgl.opengl.GL11) Shaders(gregtech.client.shader.Shaders) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ConfigHolder(gregtech.common.ConfigHolder) Framebuffer(net.minecraft.client.shader.Framebuffer) Framebuffer(net.minecraft.client.shader.Framebuffer)

Aggregations

PingPongBuffer (gregtech.client.shader.PingPongBuffer)1 Shaders (gregtech.client.shader.Shaders)1 RenderUtil (gregtech.client.utils.RenderUtil)1 ConfigHolder (gregtech.common.ConfigHolder)1 GlStateManager (net.minecraft.client.renderer.GlStateManager)1 Framebuffer (net.minecraft.client.shader.Framebuffer)1 Side (net.minecraftforge.fml.relauncher.Side)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 GL11 (org.lwjgl.opengl.GL11)1 GL13 (org.lwjgl.opengl.GL13)1