Skip to content

Instantly share code, notes, and snippets.

@joinr
Last active June 30, 2016 09:34
Show Gist options
  • Save joinr/788f23c22b3e613a643a97953a4b9962 to your computer and use it in GitHub Desktop.
Save joinr/788f23c22b3e613a643a97953a4b9962 to your computer and use it in GitHub Desktop.
Stack trace from glg2d
(import '[java.awt GraphicsEnvironment GraphicsDevice GraphicsConfiguration Transparency])
(import '[java.awt.image BufferedImage])
(defn ^BufferedImage make-imgbuffer
([w h ^Transparency t]
(let [^GraphicsEnvironment ge
(GraphicsEnvironment/getLocalGraphicsEnvironment)
^GraphicsDevice gd (.getDefaultScreenDevice ge)
^GraphicsConfiguration gc (.getDefaultConfiguration gd)]
(.createCompatibleImage gc w h t)))
([w h] (make-imgbuffer w h Transparency/TRANSLUCENT)))
(defn ^javax.swing.JLabel make-icon [^BufferedImage image]
(let [icon (javax.swing.ImageIcon. image)]
(doto (javax.swing.JLabel. ) (.setIcon icon))))
;;create an empty jframe, add a Jlabel with an empty bufferedimage as its icon,
;;then display the frame. Displays and empty 100x100 grey window.
(defn really-simple-example []
(let [the-frame (javax.swing.JFrame.)
the-image (make-icon (make-imgbuffer 100 100))]
(doto the-frame
(.add the-image)
(.pack)
(.setVisible true))))
;;create an empty jframe, add a Jlabel with an empty bufferedimage as its icon,
;;wrap the label (supports JComponent) with a GLG2DCanvas, add the canvas to the
;;frame. Should perform identically to above. Does not display.
(defn gl-example []
(let [the-frame (javax.swing.JFrame.)
the-image (make-icon (make-imgbuffer 100 100))
the-canvas (org.jogamp.glg2d.GLG2DCanvas. the-image)]
(doto the-frame
(.add the-canvas)
(.pack)
(.setVisible true))))
;;running with -Djogl.debug.DebugGL, we catch the exception...
;; [Uncaught Exception on AWT-EventQueue-0
;; #error {:cause Thread[AWT-EventQueue-0,6,main] glGetError() returned the
;; following error codes after a call to
;; glTexParameterf(<int> 0x2300, <int> 0x2200, <float> 3042.0): GL_INVALID_ENUM ( 1280 0x500),
;; :via [{:type javax.media.opengl.GLException
;; :message Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error
;; codes after a call to glTexParameterf(<int> 0x2300, <int> 0x2200, <float> 3042.0):
;; GL_INVALID_ENUM ( 1280 0x500),
;; :at [javax.media.opengl.DebugGL4bc writeGLError DebugGL4bc.java 29501]}]
;; :trace
;; [[javax.media.opengl.DebugGL4bc writeGLError DebugGL4bc.java 29501]
;; [javax.media.opengl.DebugGL4bc glTexParameterf DebugGL4bc.java 11179]
;; [org.jogamp.glg2d.impl.gl2.GL2ImageDrawer begin GL2ImageDrawer.java 44]
;; [org.jogamp.glg2d.impl.AbstractImageHelper drawImage AbstractImageHelper.java 149]
;; [org.jogamp.glg2d.impl.AbstractImageHelper drawImage AbstractImageHelper.java 104]
;; [org.jogamp.glg2d.GLGraphics2D drawImage GLGraphics2D.java 651]
;; [javax.swing.ImageIcon paintIcon ImageIcon.java 425]
;; [javax.swing.plaf.basic.BasicLabelUI paint BasicLabelUI.java 167]
;; [javax.swing.plaf.ComponentUI update ComponentUI.java 161]
;; [javax.swing.JComponent paintComponent JComponent.java 780]
;; [javax.swing.JComponent paint JComponent.java 1056]
;; [org.jogamp.glg2d.GLG2DSimpleEventListener paintGL GLG2DSimpleEventListener.java 97]
;; [org.jogamp.glg2d.GLG2DSimpleEventListener display GLG2DSimpleEventListener.java 53]
;; [jogamp.opengl.GLDrawableHelper displayImpl GLDrawableHelper.java 665]
;; [jogamp.opengl.GLDrawableHelper display GLDrawableHelper.java 649]
;; [javax.media.opengl.awt.GLCanvas$10 run GLCanvas.java 1289]
;; [jogamp.opengl.GLDrawableHelper invokeGLImpl GLDrawableHelper.java 1119]
;; [jogamp.opengl.GLDrawableHelper invokeGL GLDrawableHelper.java 994]
;; [javax.media.opengl.awt.GLCanvas$11 run GLCanvas.java 1300]
;; [javax.media.opengl.Threading invoke Threading.java 193]
;; [javax.media.opengl.awt.GLCanvas display GLCanvas.java 541]
;; [org.jogamp.glg2d.GLG2DCanvas paint GLG2DCanvas.java 338]
;; [javax.swing.JComponent paintChildren JComponent.java 889]
;; [javax.swing.JComponent paint JComponent.java 1065]
;; [javax.swing.JComponent paintChildren JComponent.java 889]
;; [javax.swing.JComponent paint JComponent.java 1065]
;; [javax.swing.JLayeredPane paint JLayeredPane.java 586]
;; [javax.swing.JComponent paintChildren JComponent.java 889]
;; [javax.swing.JComponent paintToOffscreen JComponent.java 5217]
;; [javax.swing.RepaintManager$PaintManager paintDoubleBuffered RepaintManager.java 1579]
;; [javax.swing.RepaintManager$PaintManager paint RepaintManager.java 1502]
;; [javax.swing.RepaintManager paint RepaintManager.java 1272]
;; [javax.swing.JComponent paint JComponent.java 1042]
;; [java.awt.GraphicsCallback$PaintCallback run GraphicsCallback.java 39]
;; [sun.awt.SunGraphicsCallback runOneComponent SunGraphicsCallback.java 79]
;; [sun.awt.SunGraphicsCallback runComponents SunGraphicsCallback.java 116]
;; [java.awt.Container paint Container.java 1975]
;; [java.awt.Window paint Window.java 3912]
;; [javax.swing.RepaintManager$4 run RepaintManager.java 842]
;; [javax.swing.RepaintManager$4 run RepaintManager.java 814]
;; [java.security.AccessController doPrivileged AccessController.java -2]
;; [java.security.ProtectionDomain$JavaSecurityAccessImpl doIntersectionPrivilege ProtectionDomain.java 76]
;; [javax.swing.RepaintManager paintDirtyRegions RepaintManager.java 814]
;; [javax.swing.RepaintManager paintDirtyRegions RepaintManager.java 789]
;; [javax.swing.RepaintManager prePaintDirtyRegions RepaintManager.java 738]
;; [javax.swing.RepaintManager access$1200 RepaintManager.java 64]
;; [javax.swing.RepaintManager$ProcessingRunnable run RepaintManager.java 1732]
;; [java.awt.event.InvocationEvent dispatch InvocationEvent.java 311]
;; [java.awt.EventQueue dispatchEventImpl EventQueue.java 756]
;; [java.awt.EventQueue access$500 EventQueue.java 97]
;; [java.awt.EventQueue$3 run EventQueue.java 709]
;; [java.awt.EventQueue$3 run EventQueue.java 703]
;; [java.security.AccessController doPrivileged AccessController.java -2]
;; [java.security.ProtectionDomain$JavaSecurityAccessImpl doIntersectionPrivilege ProtectionDomain.java 76]
;; [java.awt.EventQueue dispatchEvent EventQueue.java 726]
;; [java.awt.EventDispatchThread pumpOneEventForFilters EventDispatchThread.java 201]
;; [java.awt.EventDispatchThread pumpEventsForFilter EventDispatchThread.java 116]
;; [java.awt.EventDispatchThread pumpEventsForHierarchy EventDispatchThread.java 105]
;; [java.awt.EventDispatchThread pumpEvents EventDispatchThread.java 101]
;; [java.awt.EventDispatchThread pumpEvents EventDispatchThread.java 93]
;; [java.awt.EventDispatchThread run EventDispatchThread.java 82]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment