I have the following, which seems to almost work. I just create a vanilla QGLWidget with no parameters to the constructor and the following code. The problem is getting the GL3 object. The strange thing is in resizeGL I can call getGL3 without problems. But in paintGL calling it returns a javax.media.opengl.GLException: Not a GL3 implementation (NativeException) error. Not sure why. I’ve tried calling makeCurrent on the Qt context, but then resizeGL gives the same error. I’ve confirmed that GLProfile.get(…) returns a GL3 profile, but the createExternalGLContext function returns a GL2 implementation.
def initializeGL
@glContext = GLDrawableFactory.getFactory(GLProfile.get(GLProfile::GL3)).createExternalGLContext()
end
def resizeGL(width,height)
@glContext.makeCurrent()
gl = @glContext.getGL.getGL3
gl.glViewport(0,0,width,height)
end
def paintGL
@glContext.makeCurrent()
@gl = @glContext.getGL.getGL3
...
[info] com.sun.opengl.impl.x11.glx.X11ExternalGLXContext [com.sun.opengl.impl.gl2.GL2Impl@1f01b29,
[info] Drawable: com.sun.opengl.impl.x11.glx.X11ExternalGLXContext$Drawable[realized true,
[info] factory com.sun.opengl.impl.x11.glx.X11GLXDrawableFactory@7dedad,
[info] window NullWindow[config X11GLXGraphicsConfiguration[class javax.media.nativewindow.x11.X11GraphicsScreen[class javax.media.nativewindow.x11.X11GraphicsDevice[type X11, handle 0x780804f0], idx 0], visualID 0x21, fbConfigID 0x75,
[info] requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: true, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
[info] chosen GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: true, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false]], displayHandle 0x780804f0, surfaceHandle 0x4c00018, size 0x0],
[info] requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: true, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
[info] chosen GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: true, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red Accum: 16, Green Accum: 16, Blue Accum: 16, Alpha Accum: 16, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false]]]