Skip to content

Instantly share code, notes, and snippets.

@appspell
Created March 4, 2021 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appspell/37d2d8ce1a1d799ebad4887bcb10bc3b to your computer and use it in GitHub Desktop.
Save appspell/37d2d8ce1a1d799ebad4887bcb10bc3b to your computer and use it in GitHub Desktop.
private val quadVertices: FloatBuffer
init {
// set array of Quad vertices
val quadVerticesData = floatArrayOf(
// [x,y,z, U,V]
-1.0f, -1.0f, 0f, 0f, 1f,
1.0f, -1.0f, 0f, 1f, 1f,
-1.0f, 1.0f, 0f, 0f, 0f,
1.0f, 1.0f, 0f, 1f, 0f
)
quadVertices = ByteBuffer
.allocateDirect(quadVerticesData.size * FLOAT_SIZE_BYTES)
.order(ByteOrder.nativeOrder())
.asFloatBuffer()
.apply {
put(quadVerticesData).position(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment