Hi,
I’m having a small problem again.
I wrote a small texture cache for my textures, like
public class TextureCache {
static Map<String, Texture> map = new HashMap<String, Texture>();
public static Texture getTexture(String url) {
Texture tex = map.get(url);
if (tex == null)
try {
tex = TextureIO.newTexture(new URL(url), false, TextureIO.PNG);
map.put(url, tex);
}
catch (IOException e) {
e.printStackTrace();
}
catch (GLException e){
e.printStackTrace();
}
return tex;
}
Well this looks fine, but the problem is that it throws an javax.media.opengl.GLException: No OpenGL context current on this thread
Since there are about 10 different solutions available on the web, I would like to know, which one is the best, i.e. the most reliable and fastest way to get the current GL context. If anyhow possible, I would not like to use flags and stuff to call the function somewhere from my display-function.
Thank you very much in advance!
Oliver