Вопрос Дайте drowGlow

Новичок
Статус
Оффлайн
Регистрация
4 Фев 2023
Сообщения
1
Реакции[?]
0
Поинты[?]
0
решил спастить гуишку, а для нее drowGlow нужен
 
Начинающий
Статус
Оффлайн
Регистрация
11 Апр 2021
Сообщения
32
Реакции[?]
2
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
17 Июл 2022
Сообщения
19
Реакции[?]
4
Поинты[?]
0
Java:
    public static void drawGlowGradient(float x, float y, float width, float height, int glowRadius, int color1, int color2, int color3, int color4) {

        BufferedImage original = null;
        GaussianFilter op = null;
        glPushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.disableAlpha();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO);
        GlStateManager.shadeModel(7425);
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f);
        width = width + glowRadius * 2;
        height = height + glowRadius * 2;
        x = x - glowRadius;
        y = y - glowRadius;
        float _X = x - 0.25f;
        float _Y = y + 0.25f;
        int identifier = String.valueOf(width * height + width + Math.sin(glowRadius / width * height) * glowRadius + glowRadius).hashCode();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        glDisable(GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GlStateManager.enableBlend();
        int texId = -1;


        if (shadowCache.containsKey(identifier)) {
            texId = shadowCache.get(identifier);
            GlStateManager.bindTexture(texId);
        } else {
            if (width <= 0) {
                width = 1;
            }

            if (height <= 0) {
                height = 1;
            }
            original = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE);

            Graphics g = original.getGraphics();
            g.setColor(Color.white);
            g.fillRect(glowRadius, glowRadius, (int) width - glowRadius * 2, (int) height - glowRadius * 2);
            g.dispose();

            op = new GaussianFilter(glowRadius);

            BufferedImage blurred = op.filter(original, null);
            texId = TextureUtil.uploadTextureImageAllocate(TextureUtil.glGenTextures(), blurred, true, false);
            shadowCache.put(identifier, texId);
        }


        GL11.glBegin(GL11.GL_QUADS);
        RenderUtility.color(color1);
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(_X, _Y);
        RenderUtility.color(color2);
        GL11.glTexCoord2f(0, 1);
        GL11.glVertex2f(_X, _Y + height);
        RenderUtility.color(color4);
        GL11.glTexCoord2f(1, 1);
        GL11.glVertex2f(_X + width, _Y + height);
        RenderUtility.color(color3);
        GL11.glTexCoord2f(1, 0); // top right
        GL11.glVertex2f(_X + width, _Y);


        GL11.glEnd();
        GlStateManager.enableTexture2D();
        GlStateManager.shadeModel(7424);
        GlStateManager.disableBlend();
        GlStateManager.enableAlpha();
        GlStateManager.resetColor();
        glEnable(GL_CULL_FACE);
        glPopMatrix();
    }
Не знаю, в чем трабл перенести себе ГлоуУтилку с экспенсива, но держи:da:
 
Начинающий
Статус
Оффлайн
Регистрация
13 Апр 2022
Сообщения
195
Реакции[?]
7
Поинты[?]
1K
Java:
    public static void drawGlowGradient(float x, float y, float width, float height, int glowRadius, int color1, int color2, int color3, int color4) {

        BufferedImage original = null;
        GaussianFilter op = null;
        glPushMatrix();
        GlStateManager.enableBlend();
        GlStateManager.disableAlpha();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
                GlStateManager.DestFactor.ZERO);
        GlStateManager.shadeModel(7425);
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.01f);
        width = width + glowRadius * 2;
        height = height + glowRadius * 2;
        x = x - glowRadius;
        y = y - glowRadius;
        float _X = x - 0.25f;
        float _Y = y + 0.25f;
        int identifier = String.valueOf(width * height + width + Math.sin(glowRadius / width * height) * glowRadius + glowRadius).hashCode();

        GL11.glEnable(GL11.GL_TEXTURE_2D);
        glDisable(GL_CULL_FACE);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GlStateManager.enableBlend();
        int texId = -1;


        if (shadowCache.containsKey(identifier)) {
            texId = shadowCache.get(identifier);
            GlStateManager.bindTexture(texId);
        } else {
            if (width <= 0) {
                width = 1;
            }

            if (height <= 0) {
                height = 1;
            }
            original = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_INT_ARGB_PRE);

            Graphics g = original.getGraphics();
            g.setColor(Color.white);
            g.fillRect(glowRadius, glowRadius, (int) width - glowRadius * 2, (int) height - glowRadius * 2);
            g.dispose();

            op = new GaussianFilter(glowRadius);

            BufferedImage blurred = op.filter(original, null);
            texId = TextureUtil.uploadTextureImageAllocate(TextureUtil.glGenTextures(), blurred, true, false);
            shadowCache.put(identifier, texId);
        }


        GL11.glBegin(GL11.GL_QUADS);
        RenderUtility.color(color1);
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(_X, _Y);
        RenderUtility.color(color2);
        GL11.glTexCoord2f(0, 1);
        GL11.glVertex2f(_X, _Y + height);
        RenderUtility.color(color4);
        GL11.glTexCoord2f(1, 1);
        GL11.glVertex2f(_X + width, _Y + height);
        RenderUtility.color(color3);
        GL11.glTexCoord2f(1, 0); // top right
        GL11.glVertex2f(_X + width, _Y);


        GL11.glEnd();
        GlStateManager.enableTexture2D();
        GlStateManager.shadeModel(7424);
        GlStateManager.disableBlend();
        GlStateManager.enableAlpha();
        GlStateManager.resetColor();
        glEnable(GL_CULL_FACE);
        glPopMatrix();
    }
Не знаю, в чем трабл перенести себе ГлоуУтилку с экспенсива, но держи:da:
а шейдеР?
 
Сверху Снизу