@@ -61,15 +61,7 @@ public class RenderHints {
6161 private static StreamingVertexBuffer pendingVBO ;
6262
6363 /// An opengl context that's active on the background thread and is used for writing to the pending VBO.
64- private static final SharedDrawable BACKGROUND_CONTEXT ;
65-
66- static {
67- try {
68- BACKGROUND_CONTEXT = new SharedDrawable (Display .getDrawable ());
69- } catch (LWJGLException e ) {
70- throw new RuntimeException ("Could not initialized background SharedDrawable" , e );
71- }
72- }
64+ private static SharedDrawable backgroundContext ;
7365
7466 private static final ExecutorService WORKER_THREAD = Executors .newFixedThreadPool (1 );
7567 private static Future <VBOResult > renderTask ;
@@ -120,8 +112,8 @@ private static VBOResult buildVBO(StreamingVertexBuffer vbo, ArrayList<Hint> hin
120112 Vector3d eyes = new Vector3d (xd , yd , zd );
121113
122114 try {
123- if (!BACKGROUND_CONTEXT .isCurrent ()) {
124- BACKGROUND_CONTEXT .makeCurrent ();
115+ if (!backgroundContext .isCurrent ()) {
116+ backgroundContext .makeCurrent ();
125117 }
126118 } catch (LWJGLException e ) {
127119 throw new RuntimeException ("Could not activate background GL context" , e );
@@ -182,6 +174,14 @@ private static VBOResult buildVBO(StreamingVertexBuffer vbo, ArrayList<Hint> hin
182174 public static void onRenderWorldLast (RenderWorldLastEvent e ) {
183175 if (HINTS .isEmpty ()) return ;
184176
177+ if (backgroundContext == null ) {
178+ try {
179+ backgroundContext = new SharedDrawable (Display .getDrawable ());
180+ } catch (LWJGLException ex ) {
181+ throw new RuntimeException ("Could not initialized background SharedDrawable" , ex );
182+ }
183+ }
184+
185185 Profiler p = Minecraft .getMinecraft ().mcProfiler ;
186186
187187 p .startSection ("Render MM Hints" );
0 commit comments