Posted by
Sven Gothel on
Dec 12, 2010; 7:26am
URL: https://forum.jogamp.org/GLJPanel-exception-tp2063652p2072196.html
On Friday, December 10, 2010 15:25:41 gsxruk [via jogamp] wrote:
>
> Hi,
>
> I was having trouble with the GLJPanel exception on resize problem so downloaded the latest build. Now it seems a different exception occurs in my application. I created a small test application (below) to test out this latest build but receive the same exception (also shown below).
>
>
> import com.jogamp.opengl.util.Animator;
> import java.awt.BorderLayout;
> import javax.media.opengl.GL2;
> import javax.media.opengl.GLAutoDrawable;
> import javax.media.opengl.GLCapabilities;
> import javax.media.opengl.GLEventListener;
> import javax.media.opengl.GLProfile;
> import javax.media.opengl.awt.GLCanvas;
> import javax.swing.JFrame;
>
> public class Main
> {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args)
> {
> GLProfile.initSingleton(true);
> new JOGLTest();
> }
>
> private static class JOGLTest extends JFrame implements GLEventListener
> {
> private GLJPanel canvas;
>
> public JOGLTest()
> {
> super("JOGL(b246) Test");
> this.setLayout(new BorderLayout());
> this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> initialiseJOGL();
> this.setVisible(true);
> }
>
> private void initialiseJOGL()
> {
> GLProfile profile = GLProfile.getDefault();
> GLCapabilities capabilities = new GLCapabilities(profile);
> capabilities.setHardwareAccelerated(true);
> capabilities.setDoubleBuffered(true);
> canvas = new GLJPanel(capabilities);
> canvas.setSize(400, 400);
> canvas.addGLEventListener(this);
> this.add(canvas, BorderLayout.CENTER);
> this.pack();
> Animator animator = new Animator(canvas);
> animator.start();
> }
>
> @Override
> public void init(GLAutoDrawable drawable)
> {
> GL2 gl = drawable.getGL().getGL2();
> gl.glClearColor(0, 0, 0, 0);
> gl.glLoadIdentity();
> gl.glOrtho(0, drawable.getWidth(), 0, drawable.getHeight(), -1, 1);
> gl.glMatrixMode(GL2.GL_MODELVIEW);
> }
>
> @Override
> public void display(GLAutoDrawable drawable)
> {
> GL2 gl = drawable.getGL().getGL2();
> gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
> //Draw a blue square
> gl.glBegin(GL2.GL_POLYGON);
> gl.glColor4f(0, 0, 1.0f, 1.0f);
> gl.glVertex2f(150, 150);
> gl.glVertex2f(150, 250);
> gl.glVertex2f(250, 250);
> gl.glVertex2f(250, 150);
> gl.glEnd();
> gl.glFlush();
> }
>
> @Override
> public void reshape(GLAutoDrawable drawable,
> int left, int top, int width, int height)
> {
> GL2 gl = drawable.getGL().getGL2();
> gl.glViewport(0, 0, width, height);
> gl.glLoadIdentity();
> gl.glOrtho(0, width, 0, height, -1, 1);
> }
>
> @Override
> public void dispose(GLAutoDrawable drawable)
> {
> //Do nothing
> }
> }
> }
>
> javax.media.opengl.GLException: Dispose case (no init action given): Native context must be created: com.jogamp.opengl.impl.windows.wgl.WindowsPbufferWGLContext [OpenGL -1.-1, options 0x0, null, handle 0x0, null,
> Drawable: com.jogamp.opengl.impl.windows.wgl.WindowsPbufferWGLDrawable[Realized true,
> Factory com.jogamp.opengl.impl.windows.wgl.WindowsWGLDrawableFactory@150bd4d,
> handle 0x4b010b89,
> Window ProxySurface[config WindowsWGLGraphicsConfiguration[class javax.media.nativewindow.DefaultGraphicsScreen[class javax.media.nativewindow.DefaultGraphicsDevice[type Windows, connection decon, unitID 0, handle 0x0], idx 0], pfdID 1, ARB-Choosen true,
> requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: false, Stereo: false, HardwareAccelerated: true, DepthBits: 16, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
> chosen GLCapabilities[Capabilities[Onscreen: false, Red: 8, Green: 8, Blue: 8, Alpha: 8, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: true, DoubleBuffered: false, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 8, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false]], displayHandle 0x0, surfaceHandle 0x4b010b89, size 256x256]]]
> at com.jogamp.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:326)
> at com.jogamp.opengl.impl.GLPbufferImpl.destroy(GLPbufferImpl.java:109)
> at javax.media.opengl.awt.GLJPanel$PbufferBackend.handleReshape(GLJPanel.java:1134)
> at javax.media.opengl.awt.GLJPanel.handleReshape(GLJPanel.java:585)
> at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:322)
> at javax.swing.JComponent.paint(JComponent.java:1029)
> at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
> at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1479)
> at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1410)
> at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
> at javax.swing.JComponent._paintImmediately(JComponent.java:5072)
> at javax.swing.JComponent.paintImmediately(JComponent.java:4882)
> at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
> at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
> at com.jogamp.opengl.util.AWTAnimatorImpl$1.run(AWTAnimatorImpl.java:160)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>
>
> If the GLJPanel is changed to a GLCanvas, the code executes with no problems at all.
>
> I am doing something wrong?
http://jogamp.org/bugzilla/show_bug.cgi?id=427However, I have to check your code as well,
since I can still reproduce this exception. Thank you.
Laters, Sven