File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change 1+ package main.framework
2+
3+ import com.jogamp.newt.opengl.GLWindow
4+ import com.jogamp.opengl.GL3
5+ import com.jogamp.opengl.GLAutoDrawable
6+
7+ /* *
8+ * Created by GBarbieri on 22.03.2017.
9+ */
10+
11+ inline infix fun GLWindow.gl3 (crossinline inject : GL3 .() -> Unit ) {
12+ invoke(false ) { glAutoDrawable ->
13+ glAutoDrawable.gl.gL3.inject()
14+ false
15+ }
16+ }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import glm.vec._3.Vec3
1313import glm.vec._4.Vec4
1414import main.framework.Framework
1515import main.framework.Semantic
16+ import main.framework.gl3
1617import uno.buffer.*
1718import uno.glsl.programOf
1819
@@ -157,17 +158,12 @@ class DepthClamping_ : Framework("Tutorial 05 - Depth Clamping") {
157158
158159 when (keyEvent.keyCode) {
159160 KeyEvent .VK_ESCAPE -> quit()
160- KeyEvent .VK_SPACE -> {
161- window.invoke(false ) { glAutoDrawable ->
162- with (glAutoDrawable.gl.gL3) {
163- if (depthClampingActive)
164- glDisable(GL_DEPTH_CLAMP )
165- else
166- glEnable(GL_DEPTH_CLAMP )
167- }
168- depthClampingActive = ! depthClampingActive
169- false
170- }
161+ KeyEvent .VK_SPACE -> window.gl3 {
162+ if (depthClampingActive)
163+ glDisable(GL_DEPTH_CLAMP )
164+ else
165+ glEnable(GL_DEPTH_CLAMP )
166+ depthClampingActive = ! depthClampingActive
171167 }
172168 }
173169 }
You can’t perform that action at this time.
0 commit comments