Пытаюсь освоить опенгл по немногу( с помощью ии и просто форумов) и по итогу при запуске майна он крашится
вот код
вот краш
вот код
Java:
package bezd2rr.font.mixin.client;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class)
public abstract class TitleScreenMixin extends Screen {
protected TitleScreenMixin(Text title) {
super(title);
}
@Inject(method = "init", at = @At("TAIL"))
private void addSimpleButton(CallbackInfo ci) {
int x = this.width / 2 - 124;
int y = this.height / 4 + 132 - 24;
ButtonWidget myButton = ButtonWidget.builder(
Text.literal("𝐀"),
btn -> {
System.out.println("+");
}
).dimensions(x, y, 20, 20).build();
this.addDrawableChild(myButton);
}
@Inject(method = "render", at = @At("TAIL"))
private void renderCircle(CallbackInfo ci) {
GL11.glEnable(GL11.GL_STENCIL_TEST);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF);
GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE);
GL11.glStencilMask(0xFF);
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);
float centerX = this.width / 2.0f;
float centerY = this.height / 2.0f;
float radius = 50.0f;
int segments = 64;
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex2f(centerX, centerY);
for (int i = 0; i <= segments; i++) {
float angle = (float) (2.0 * Math.PI * i / segments);
float x = centerX + (float) Math.cos(angle) * radius;
float y = centerY + (float) Math.sin(angle) * radius;
GL11.glVertex2f(x, y);
}
GL11.glEnd();
GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);
GL11.glStencilMask(0x00);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex2f(centerX, centerY);
for (int i = 0; i <= segments; i++) {
float angle = (float) (2.0 * Math.PI * i / segments);
float x = centerX + (float) Math.cos(angle) * radius;
float y = centerY + (float) Math.sin(angle) * radius;
GL11.glVertex2f(x, y);
}
GL11.glEnd();
GL11.glDisable(GL11.GL_STENCIL_TEST);
RenderSystem.disableBlend();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
}
}
вот краш
[01:31:54] [Render thread/INFO] (Minecraft) Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas
FATAL ERROR in native method: Thread[#3,Render thread,10,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
at org.lwjgl.opengl.GL11.glBegin(Native Method)
at net.minecraft.client.gui.screen.TitleScreen.handler$zjf000$custom-font$renderCircle(TitleScreen.java:557)
at net.minecraft.client.gui.screen.TitleScreen.render(TitleScreen.java:295)
at net.minecraft.client.gui.screen.Screen.renderWithTooltip(Screen.java:110)
at net.minecraft.client.render.GameRenderer.render(GameRenderer.java:945)
at net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1219)
at net.minecraft.client.MinecraftClient.run(MinecraftClient.java:802)
at net.minecraft.client.main.Main.main(Main.java:250)
at java.lang.invoke.LambdaForm$DMH/0x00000190c0014000.invokeStaticInit(java.base@24.0.1/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x00000190c0003400.invokeExact_MT(java.base@24.0.1/LambdaForm$MH)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at java.lang.invoke.LambdaForm$DMH/0x00000190c0002c00.invokeStatic(java.base@24.0.1/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x00000190c0003400.invokeExact_MT(java.base@24.0.1/LambdaForm$MH)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)