1
Java / Re: Obligatory 'loading resources on a thread' post.
« on: January 31, 2013, 12:13:40 am »
Thanks, guys, for the speedy replies. OpenGL is not my area of expertise so I really appreciate the assistance.
pdinklag - if you're able to repro the problem and you make any progress towards solving it I'd be eager to hear about it. Thank you for looking into it.
Even though Laurent has said it's a no-no, I tried out the Context instance solution this evening (just for science), and I was eventually able to get it working by calling setActive(true) then creating the Texture and finally calling setActive(false). Something like:
Just thought I'd share incase the information is useful in any way.
pdinklag - if you're able to repro the problem and you make any progress towards solving it I'd be eager to hear about it. Thank you for looking into it.
Even though Laurent has said it's a no-no, I tried out the Context instance solution this evening (just for science), and I was eventually able to get it working by calling setActive(true) then creating the Texture and finally calling setActive(false). Something like:
public void run() {
Context context = new Context();
try {
context.setActive(true);
Texture texture = new Texture();
texture.loadFromFile(Paths.get("canyonlands_large.jpg"));
context.setActive(false);
cache.put(KEY, texture);
} catch (Exception e) {
e.printStackTrace();
}
}
Context context = new Context();
try {
context.setActive(true);
Texture texture = new Texture();
texture.loadFromFile(Paths.get("canyonlands_large.jpg"));
context.setActive(false);
cache.put(KEY, texture);
} catch (Exception e) {
e.printStackTrace();
}
}
Just thought I'd share incase the information is useful in any way.