Fixes a ClassCastException in the AWT GLCanvas

We will have to understand why the wrong factory is returned in some cases.