Hi guys,
I’m working on improving the stability of my jogl-app.
As I encountered problems related to graphics drivers and cards, that I can’t influence, I would like to circumvent these by turning off hardware acceleration in case of errrors.
When does an errror occur?
Well, if a GLException is thrown (eg. in the display-function of my GLEventListener).
I’ve got the following code
public class MyJoglApp implements GLEventListener {
public GLCanvas canvas;
public void display(GLAutoDrawable drawable) {
try {
drawEverything();
}
catch(GLException e){
System.out.println("GLException in display function catched!");
e.printStackTrace();
System.out.println("Switching to non-hardware-accelerated rendering now.");
GLCapabilities glCaps = new GLCapabilities();
glCaps.setRedBits(8);
glCaps.setBlueBits(8);
glCaps.setGreenBits(8);
glCaps.setAlphaBits(8);
glCaps.setHardwareAccelerated(false);
// now exchange the canvas
Container cont = canvas.getParent();
cont.remove(canvas);
cont.validate();
canvas = null;
canvas = new GLCanvas(glCaps);
canvas.addGLEventListener(this);
cont.add(canvas);
cont.validate();
}
}
}
But it falls into an infinite loop, since the call to setHardwareAccelerated(false) seems to have no effect:
If I initialize my canvas directly with this requirement, still hardware acceleration is turned on!!!
So, I think my problem could easily be solved, if I knew how to force hardware acceleration being turned off.
Best regards,
Oliver