Re: How to make screenshot on SWT
Posted by
mjamesupc on
Jun 09, 2015; 9:52pm
URL: https://forum.jogamp.org/How-to-make-screenshot-on-SWT-tp4033448p4034626.html
gouessej wrote
Edit.: You can use the AWT GLCanvas with the SWT/AWT bridge (SWT_AWT), the
SWT GLCanvas or the NEWT SWT canvas NewtCanvasSWT instead of the obsolete
SWT OpenGL canvas provided by SWT.
I am aware that org.eclipse.swt.opengl.GLCanvas is obsolete, but I am tasked with modifying a large project that has relied on org.eclipse.swt.opengl.GLCanvas, and frankly I'm intimidated by the large number of compilation errors when I change GLCanvas from org.eclipse.swt to com.jogamp.opengl.awt or com.jogamp.opengl.swt. One particular requirement is being able to cast from GLCanvas to Canvas, which is possible with org.eclipse.swt.opengl.GLCanvas but so far not possible with com.jogamp.opengl.awt.GLCanvas.
What should be done with SWT JOGL or AWT JOGL to set and release contexts? I can't seem to find any documentation about this. Is this what frame.add( glcanvas ) accomplishes?
I removed GLContextBridge entirely from the project, and am using GLContext.getCurrentGL() instead of GLU.getCurrentGL(), and still see the same errors: screenshot problems and the dreaded "No OpenGL context current on thread" elsewhere when calling TextRenderer getBounds().
So then I attempted to refactor with com.jogamp.opengl.awt.GLCanvas but find I cannot cast from GLCanvas to Canvas where I need to (which is possible with com.jogamp.opengl.swt.GLCanvas, but other errors prevent the workbench from starting).