Проблема с рендером текстуры (Решено)

Версия Minecraft
1.12.2
API
Forge
22
1
0
Рендер:
GL11.glEnable(GL11.GL_BLEND);

            ResourceLocation hpIcon = new ResourceLocation("exile_z", "textures/overlay/hpicon.png");
            mc.getTextureManager().bindTexture(hpIcon);
            mc.renderEngine.bindTexture(hpIcon);
            drawTexturedModalRect(textX - 150, textY - 50, 0, 0, 50, 40);

GL11.glDisable(GL11.GL_BLEND);


drawTexturedModalRect:
private void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
        mc.ingameGUI.drawTexturedModalRect(x, y, textureX, textureY, width, height);
    }

В игре отображается как просто красный квадрат, вместо квадрата с крестом по середине, пробовал делать просто крестик без фона, он вообще не отображается, не важно какого цвета, пробовал разного. Где ошибка?
 

Вложения

  • 1689758608922.png
    1689758608922.png
    36.7 KB · Просмотры: 10
  • hpicon.png
    hpicon.png
    1.8 KB · Просмотры: 11
Решение
Решение получилось таким кодом
Java:
private void drawTexturedModalRectWithSize(int x, int y, int textureX, int textureY, int width, int height) {
        float u = 1.0f / (float)width;
        float v = 1.0f / (float)height;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();

        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buffer.pos(x, y + height, 0.0).tex(textureX * u, (textureY + height) * v).endVertex();
        buffer.pos(x + width, y + height, 0.0).tex((textureX + width) * u, (textureY + height) * v).endVertex();
        buffer.pos(x + width, y, 0.0).tex((textureX + width) * u, textureY * v).endVertex();
        buffer.pos(x, y...
22
1
0
Решение получилось таким кодом
Java:
private void drawTexturedModalRectWithSize(int x, int y, int textureX, int textureY, int width, int height) {
        float u = 1.0f / (float)width;
        float v = 1.0f / (float)height;

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();

        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buffer.pos(x, y + height, 0.0).tex(textureX * u, (textureY + height) * v).endVertex();
        buffer.pos(x + width, y + height, 0.0).tex((textureX + width) * u, (textureY + height) * v).endVertex();
        buffer.pos(x + width, y, 0.0).tex((textureX + width) * u, textureY * v).endVertex();
        buffer.pos(x, y, 0.0).tex(textureX * u, textureY * v).endVertex();

        tessellator.draw();
    }
 
Последнее редактирование:
Сверху