Skip to content

Commit

Permalink
Merge branch 'main' into shortbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelydaniel committed Dec 29, 2023
2 parents b5ceec7 + f5311eb commit 3b5c92a
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .idea/kgl.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ object KglAndroid : Kgl {

override fun drawArrays(mode: Int, first: Int, count: Int) = GL.glDrawArrays(mode, first, count)

override fun drawElements(mode: Int, count: Int, type: Int) = GL.glDrawElements(mode, count, type, 0)

override fun getError(): Int = GL.glGetError()
override fun finish() = GL.glFinish()

Expand Down
4 changes: 4 additions & 0 deletions kgl-ios/src/nativeMain/kotlin/com.danielgergely.kgl/KglIos.kt
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ object KglIos : Kgl {
glDrawArrays(mode.toUInt(), first, count)
}

override fun drawElements(mode: Int, count: Int, type: Int) {
glDrawElements(mode.toUInt(), count, type.toUInt(), null)
}

override fun getError(): Int {
return glGetError().toInt()
}
Expand Down
1 change: 1 addition & 0 deletions kgl-jogl/src/main/kotlin/com/danielgergely/kgl/KglJogl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class KglJogl(private val gl: GL) : Kgl {
gl.glDeleteVertexArrays(1, intArrayOf(vertexArrayObject), 0)

override fun drawArrays(mode: Int, first: Int, count: Int) = gl.glDrawArrays(mode, first, count)
override fun drawElements(mode: Int, count: Int, type: Int) = gl.glDrawElements(mode, count, type, 0)

override fun getError(): Int = gl.glGetError()
override fun finish() = gl.glFinish()
Expand Down
4 changes: 4 additions & 0 deletions kgl-lwjgl/src/main/kotlin/com/danielgergely/kgl/KglLwjgl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ object KglLwjgl : Kgl {
GL.glDrawArrays(mode, first, count)
}

override fun drawElements(mode: Int, count: Int, type: Int) {
GL.glDrawElements(mode, count, type, 0)
}

override fun getError(): Int {
return GL.glGetError()
}
Expand Down
7 changes: 7 additions & 0 deletions kgl/src/commonMain/kotlin/com/danielgergely/kgl/DebugKgl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,13 @@ public class DebugKgl(
return ret
}

override fun drawElements(mode: Int, count: Int, type: Int) {
runBefore("drawElements")
val ret = kgl.drawElements(mode, count, type)
runAfter("drawElements")
return ret
}

override fun getError(): Int {
runBefore("getError")
val ret = kgl.getError()
Expand Down
1 change: 1 addition & 0 deletions kgl/src/commonMain/kotlin/com/danielgergely/kgl/Kgl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public interface Kgl {
public fun deleteVertexArray(vertexArrayObject: VertexArrayObject)

public fun drawArrays(mode: Int, first: Int, count: Int)
public fun drawElements(mode: Int, count: Int, type: Int)

public fun getError(): Int
public fun finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ public class KglJs(private val gl: WebGLRenderingContext) : Kgl {

public override fun drawArrays(mode: Int, first: Int, count: Int): Unit = gl.drawArrays(mode, first, count)

public override fun drawElements(mode: Int, count: Int, type: Int): Unit = gl.drawElements(mode, count, type, 0)

public override fun getError(): Int = gl.getError()
public override fun finish(): Unit = gl.finish()

Expand Down

0 comments on commit 3b5c92a

Please sign in to comment.