Jump to content

Recommended Posts

Posted

Hey guys, I am trying to make my code cause the player to go to the next shader, but it gives me the following error(and the nearby chunks vanish then re-render) when activated:

 

 

[15:15:30] [Netty Local Client IO #0/WARN]: Failed to load shader: minecraft:shaders/post/notch.json
net.minecraft.client.util.JsonException: Invalid shaders/post/notch.json targets[0]: No OpenGL context found in the current thread.
at net.minecraft.client.util.JsonException.func_151379_a(JsonException.java:61) ~[JsonException.class:?]
at net.minecraft.client.shader.ShaderGroup.parseGroup(ShaderGroup.java:81) ~[shaderGroup.class:?]
at net.minecraft.client.shader.ShaderGroup.<init>(ShaderGroup.java:54) ~[shaderGroup.class:?]
at net.minecraft.client.renderer.EntityRenderer.loadShader(EntityRenderer.java:261) [EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.activateNextShader(EntityRenderer.java:247) [EntityRenderer.class:?]
at the_fireplace.unlogicii.proxy.ClientProxy.changeShader(ClientProxy.java:53) [ClientProxy.class:?]
at the_fireplace.unlogicii.network.ChangeShaderMessage$Handler.handleClientMessage(ChangeShaderMessage.java:33) [ChangeShaderMessage$Handler.class:?]
at the_fireplace.unlogicii.network.ChangeShaderMessage$Handler.handleClientMessage(ChangeShaderMessage.java:27) [ChangeShaderMessage$Handler.class:?]
at the_fireplace.unlogicii.network.AbstractMessageHandler.onMessage(AbstractMessageHandler.java:18) [AbstractMessageHandler.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:37) [simpleChannelHandlerWrapper.class:?]
at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:17) [simpleChannelHandlerWrapper.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:90) [FMLProxyPacket.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:158) [NetworkManager.class:?]
at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:54) [NetworkManager.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:389) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:255) [NetworkDispatcher.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:53) [NetworkDispatcher.class:?]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [simpleChannelInboundHandler.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:326) [LocalChannel.class:4.0.23.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:45) [LocalChannel.class:4.0.23.Final]
at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:312) [LocalChannel$5.class:4.0.23.Final]
at io.netty.channel.local.LocalEventLoop.run(LocalEventLoop.java:33) [LocalEventLoop.class:4.0.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [singleThreadEventExecutor$2.class:4.0.23.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]
Caused by: java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
at org.lwjgl.opengl.GL11.glEnable(GL11.java:1012) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
at net.minecraft.client.renderer.GlStateManager$BooleanState.setState(GlStateManager.java:590) ~[GlStateManager$BooleanState.class:?]
at net.minecraft.client.renderer.GlStateManager$BooleanState.setEnabled(GlStateManager.java:579) ~[GlStateManager$BooleanState.class:?]
at net.minecraft.client.renderer.GlStateManager.enableDepth(GlStateManager.java:109) ~[GlStateManager.class:?]
at net.minecraft.client.shader.Framebuffer.createBindFramebuffer(Framebuffer.java:51) ~[Framebuffer.class:?]
at net.minecraft.client.shader.Framebuffer.<init>(Framebuffer.java:39) ~[Framebuffer.class:?]
at net.minecraft.client.shader.ShaderGroup.addFramebuffer(ShaderGroup.java:312) ~[shaderGroup.class:?]
at net.minecraft.client.shader.ShaderGroup.initTarget(ShaderGroup.java:128) ~[shaderGroup.class:?]
at net.minecraft.client.shader.ShaderGroup.parseGroup(ShaderGroup.java:77) ~[shaderGroup.class:?]
... 37 more

 

 

And so you can trace the issue, here is the ClientProxy, where it is being changed from:

ClientProxy

And the packet class that calls the method to change the shader:

ChangeShaderMessage

 

I don't understand how no OpenGL context can be found in the thread when it is being called on the client side, so I am stumped on this one.

 

If you have any questions or comments, let me know. Any help is appreciated.

 

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

This might be caused becuase your code is handled by a non opengl thread. Meaning that opengl will complain about that. And from the top of my head, messages/packets are handled in a side thread in MC 1.8. So maybe bringing it back to the mainThread would work? (Im not sure wich thread you need)

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

Posted

This might be caused becuase your code is handled by a non opengl thread. Meaning that opengl will complain about that. And from the top of my head, messages/packets are handled in a side thread in MC 1.8. So maybe bringing it back to the mainThread would work? (Im not sure wich thread you need)

I figured as much. I still don't know which thread to switch it to and how to switch it. Or perhaps, there is a better solution. Anyone know?

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

Packets are handled on a Netty thread, as N247S said. You need to schedule a task to run on the main thread before you can safely interact with normal Minecraft classes.

 

This tutorial explains how to schedule the task.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.