Jump to content

[1.12.2] DynamicTexture declaration crashes the game


nocot

Recommended Posts

I'm creating a mod based on external libraries that are making snapshots from videos. My goal is to use these snapshots - made as buffered images - to display them in a GUI. My problem is that when an event is converting a buffered image into a dynamic texture, the game eventually crashes. Despite my tryings, I still get the same error with the same function. Here is my crash report:

---- Minecraft Crash Report ----
// You're mean.

Time: 8/1/18 8:10 PM
Description: Exception in server tick loop

java.lang.RuntimeException: No OpenGL context found in the current thread.
	at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
	at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1403)
	at net.minecraft.client.renderer.GlStateManager.generateTexture(GlStateManager.java:465)
	at net.minecraft.client.renderer.texture.TextureUtil.glGenTextures(TextureUtil.java:38)
	at net.minecraft.client.renderer.texture.AbstractTexture.getGlTextureId(AbstractTexture.java:54)
	at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:30)
	at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:20)
	at com.kacpergutowski.rfmod.Main.onPlayerTick(Main.java:144)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_10_Main_onPlayerTick_EntityJoinWorldEvent.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
	at net.minecraft.world.WorldServer.loadEntities(WorldServer.java:1128)
	at net.minecraft.world.chunk.Chunk.onLoad(Chunk.java:918)
	at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:105)
	at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94)
	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:130)
	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:101)
	at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:147)
	at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:383)
	at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:143)
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:160)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:552)
	at java.lang.Thread.run(Unknown Source)

I see that it might be a server/client side problem but I cannot see what exactly is  causing that issue.

 

 

Here is my mod code (so minimalist because I'm just trying to investigate the problem):

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION)
public class Main {
	int i = 0;
	
	@Instance
	public static Main instance;
	
	@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.COMMON_PROXY_CLASS)
	public static CommonProxy proxy;
	
	@EventHandler
	public void PreInit(FMLPreInitializationEvent event)
	{
		
	}
	
	@EventHandler
	public void Init(FMLInitializationEvent event)
	{
		MinecraftForge.EVENT_BUS.register(new com.kacpergutowski.rfmod.events.EventHandler());
		MinecraftForge.EVENT_BUS.register(this);
	}
	
	@EventHandler
	public void PostInit(FMLPostInitializationEvent event)
	{
		
	}
	
	
	 @SideOnly(Side.CLIENT)
	 @SubscribeEvent
	 public void onPlayerTick(EntityJoinWorldEvent evt) throws Exception {
		 
		FFmpegFrameGrabber g = new FFmpegFrameGrabber("C:/Users/Kacper/Documents/file.mp4");
		g.start();
	    Frame f = g.grab();
	    OpenCVFrameConverter.ToIplImage iplConverter = new OpenCVFrameConverter.ToIplImage();
	    IplImage img = iplConverter.convert(f);
	    Java2DFrameConverter paintConverter = new Java2DFrameConverter();
	    BufferedImage image = paintConverter.getBufferedImage(f,1);
	    DynamicTexture texture = new DynamicTexture(image);
		
    }
	
}

Everything is placed in one event just for testing purposes.

 

For sure my problem is obvious, but I still can't get it. Anyone who can help me with it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.