Skip to content

Commit 2a14213

Browse files
Merge pull request #140 from RecursivePineapple/shared-context-init
Misc fixes
2 parents bff4c89 + 08accc4 commit 2a14213

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/main/java/com/recursive_pineapple/matter_manipulator/common/building/GTAnalysisResult.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ public GTAnalysisResult clone() {
682682
dup.mTTParams = mTTParams == null ? null : mTTParams.clone();
683683
dup.mAmperes = mAmperes;
684684
dup.mFluidPipeRestriction = mFluidPipeRestriction;
685+
dup.mMaxParallels = mMaxParallels;
685686

686687
return dup;
687688
}

src/main/java/com/recursive_pineapple/matter_manipulator/common/items/manipulator/RenderHints.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)