Login  Register

Re: Need Help Solving OpenGL/GLSL 4.4 Issues

Posted by xghost on Jul 17, 2014; 9:21am
URL: https://forum.jogamp.org/Need-Help-Solving-OpenGL-GLSL-4-4-Issues-tp4032557p4032581.html

jmaasing wrote
Try this sample, I chucked it together from code I had (so it isn't well documented and you need to fix package name et c) but it works.

Edit: oh and you probably need to fix the version line in the shader, I'm on Mac which only supports OpenGL 4.1
I tried your sample and it seems to work just fine 'as is'. I've uploaded a picture of the output while it runs here for confirmation:




The code also works after changing the shaders to use version 440 from 410. I did, however, notice that when you exit, an exception is thrown and a significant amount of output is produced.

Thanks for the help. I'm including the console output during its last moments below, triggered by closing the window.

EDIT: The application works regardless of whether the -Dsun.java2d.d3d=false argument is sent to the JVM or not. I expected this to be the case at least under GNU/Linux.

----------
glDrawArrays(<int> 0x4, <int> 0x0, <int> 0x3)
glBindFramebuffer(<int> 0x8CA9, <int> 0x0)
glClear(<int> 0x4100)
glUseProgram(<int> 0x3)
glBindVertexArray(<int> 0x2)
glEnableVertexAttribArray(<int> 0x0)
glDrawArrays(<int> 0x4, <int> 0x0, <int> 0x3)
Catched Exception on thread main-Display-.x11_:0-1-EDT-1
javax.media.opengl.GLException: Surface not ready to lock: X11OnscreenGLXDrawable[Realized true,
	Factory   jogamp.opengl.x11.glx.X11GLXDrawableFactory@7de69f2,
	Handle    0x0,
	Surface   jogamp.newt.driver.x11.WindowDriver[Config X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f1824019be0, owner true, ResourceToolkitLock[obj 0x1afd92e7, isOwner false, <7db78988, 1ca68033>[count 0, qsz 0, owner <NULL>]]], idx 0], visualID 0x27, fbConfigID 0x10d,
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 8/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], on-scr[.]],
	chosen    GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], on-scr[.]]]
, NEWT-Screen[.x11_:0-1-s0, idx 0, refCount 1, vsize [ 0 / 0  1920 x 1080 ], X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f1824001040, owner true, ResourceToolkitLock[obj 0x772aa2f6, isOwner true, <10310199, 15fec1d>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>]]], idx 0], NEWT-Display[.x11_:0-1, excl false, refCount 0, hasEDT true, edtRunning true, null], monitors: null]
, ParentWindow null
, ParentWindowHandle 0x0 (false)
, WindowHandle 0x0
, SurfaceHandle 0x0 (lockedExt window false, surface false)
, Pos 456/232 (auto false), size 640x480
, Visible false, focus false
, Undecorated false (false)
, AlwaysOnTop false, Fullscreen false
, WrappedSurface null
, ChildWindows 0, SurfaceUpdatedListeners num 0 [], WindowListeners num 2 [com.jogamp.newt.opengl.GLWindow$2@4086649f, ray.cg.demos.demo5.Demo5$1@373823d1, ], MouseListeners num 0 [], PointerGestures default true, custom 0 [], KeyListeners num 0 [], windowLock <46b78aa9, 3bf08184>[count 2, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>], surfaceLockCount 0]]
	at jogamp.opengl.GLContextImpl.destroy(GLContextImpl.java:386)
	at jogamp.opengl.GLDrawableHelper.disposeGL(GLDrawableHelper.java:1042)
	at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:350)
	at com.jogamp.newt.opengl.GLWindow.access$300(GLWindow.java:111)
	at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.destroyActionInLock(GLWindow.java:490)
	at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:1107)
	at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2006)
	at jogamp.newt.WindowImpl.destroy(WindowImpl.java:1170)
	at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:431)
	at ray.cg.demos.demo5.Demo5.stop(Demo5.java:94)
	at ray.cg.demos.demo5.Demo5.access$1(Demo5.java:88)
	at ray.cg.demos.demo5.Demo5$1.windowDestroyNotify(Demo5.java:117)
	at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:3520)
	at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:3452)
	at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:1086)
	at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:434)
	at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2008)
	at jogamp.newt.WindowImpl.destroy(WindowImpl.java:1170)
	at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:431)
	at jogamp.opengl.GLAutoDrawableBase.destroyAvoidAwareOfLocking(GLAutoDrawableBase.java:300)
	at jogamp.opengl.GLAutoDrawableBase.defaultWindowDestroyNotifyOp(GLAutoDrawableBase.java:268)
	at com.jogamp.newt.opengl.GLWindow.access$000(GLWindow.java:111)
	at com.jogamp.newt.opengl.GLWindow$1.run(GLWindow.java:123)
	at jogamp.newt.WindowImpl.windowDestroyNotify(WindowImpl.java:3747)
	at jogamp.newt.driver.x11.DisplayDriver.DispatchMessages0(Native Method)
	at jogamp.newt.driver.x11.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:113)
	at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:733)
	at jogamp.newt.DisplayImpl$7.run(DisplayImpl.java:656)
	at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:341)
javax.media.opengl.GLException: Error making context 0x7f18240314e0 current on Thread main-Display-.x11_:0-1-EDT-1 with display 0x7f1824019be0, drawableWrite 0x0, drawableRead 0x0 - X11GLXContext [Version 4.4 (Core profile, arb, ES2 compat, ES3 compat, FBO, hardware) - 4.4.0 NVIDIA 331.79 [GL 4.4.0, vendor 331.79.0 (NVIDIA 331.79)], options 0x1c05, this 0x6e16ffd, handle 0x7f18240314e0, isShared false, TraceGL4bc [this 0x6819f939 implementing javax.media.opengl.GL4bc,
	 downstream: DebugGL4bc [this 0x1394294 implementing javax.media.opengl.GL4bc,
	 downstream: jogamp.opengl.gl4.GL4bcImpl@5642032c
	]
	],
	 quirks: [NoDoubleBufferedPBuffer, NoSetSwapIntervalPostRetarget],
	Drawable: X11OnscreenGLXDrawable[Realized true,
	Factory   jogamp.opengl.x11.glx.X11GLXDrawableFactory@7de69f2,
	Handle    0x0,
	Surface   jogamp.newt.driver.x11.WindowDriver[Config X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f1824019be0, owner true, ResourceToolkitLock[obj 0x1afd92e7, isOwner true, <7db78988, 1ca68033>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>]]], idx 0], visualID 0x27, fbConfigID 0x10d,
	requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 8/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], on-scr[.]],
	chosen    GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4/GL4.hw], on-scr[.]]]
, NEWT-Screen[.x11_:0-1-s0, idx 0, refCount 1, vsize [ 0 / 0  1920 x 1080 ], X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f1824001040, owner true, ResourceToolkitLock[obj 0x772aa2f6, isOwner true, <10310199, 15fec1d>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>]]], idx 0], NEWT-Display[.x11_:0-1, excl false, refCount 0, hasEDT true, edtRunning true, null], monitors: null]
, ParentWindow null
, ParentWindowHandle 0x0 (false)
, WindowHandle 0x0
, SurfaceHandle 0x0 (lockedExt window false, surface false)
, Pos 456/232 (auto false), size 640x480
, Visible false, focus false
, Undecorated false (false)
, AlwaysOnTop false, Fullscreen false
, WrappedSurface null
, ChildWindows 0, SurfaceUpdatedListeners num 0 [], WindowListeners num 2 [com.jogamp.newt.opengl.GLWindow$2@4086649f, ray.cg.demos.demo5.Demo5$1@373823d1, ], MouseListeners num 0 [], PointerGestures default true, custom 0 [], KeyListeners num 0 [], windowLock <46b78aa9, 3bf08184>[count 3, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>], surfaceLockCount 1]], direct true] 
	at jogamp.opengl.x11.glx.X11GLXContext.makeCurrentImpl(X11GLXContext.java:417)
	at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:723)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:561)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:518)
	at jogamp.opengl.GLDrawableHelper.disposeGL(GLDrawableHelper.java:1030)
	at jogamp.opengl.GLAutoDrawableBase.destroyImplInLock(GLAutoDrawableBase.java:350)
	at com.jogamp.newt.opengl.GLWindow.access$300(GLWindow.java:111)
	at com.jogamp.newt.opengl.GLWindow$GLLifecycleHook.destroyActionInLock(GLWindow.java:490)
	at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:1107)
	at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2006)
	at jogamp.newt.WindowImpl.destroy(WindowImpl.java:1170)
	at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:431)
	at ray.cg.demos.demo5.Demo5.stop(Demo5.java:94)
	at ray.cg.demos.demo5.Demo5.access$1(Demo5.java:88)
	at ray.cg.demos.demo5.Demo5$1.windowDestroyNotify(Demo5.java:117)
	at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:3520)
	at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:3452)
	at jogamp.newt.WindowImpl$DestroyAction.run(WindowImpl.java:1086)
	at jogamp.newt.DisplayImpl.runOnEDTIfAvail(DisplayImpl.java:434)
	at jogamp.newt.WindowImpl.runOnEDTIfAvail(WindowImpl.java:2008)
	at jogamp.newt.WindowImpl.destroy(WindowImpl.java:1170)
	at com.jogamp.newt.opengl.GLWindow.destroy(GLWindow.java:431)
	at jogamp.opengl.GLAutoDrawableBase.destroyAvoidAwareOfLocking(GLAutoDrawableBase.java:300)
	at jogamp.opengl.GLAutoDrawableBase.defaultWindowDestroyNotifyOp(GLAutoDrawableBase.java:268)
	at com.jogamp.newt.opengl.GLWindow.access$000(GLWindow.java:111)
	at com.jogamp.newt.opengl.GLWindow$1.run(GLWindow.java:123)
	at jogamp.newt.WindowImpl.windowDestroyNotify(WindowImpl.java:3747)
	at jogamp.newt.driver.x11.DisplayDriver.DispatchMessages0(Native Method)
	at jogamp.newt.driver.x11.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:113)
	at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:733)
	at jogamp.newt.DisplayImpl$7.run(DisplayImpl.java:656)
	at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:341)
Thread[main-Display-.x11_:0-1-EDT-1,5,main]: Warning: Default-EDT about (2) to stop, task executed. Remaining tasks: 1 - Thread[main-Display-.x11_:0-1-EDT-1,5,main]
Window destroyed
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0, 0x7f1824001040, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0, 0x7f1824019be0, refCount 1, unCloseable false]