Skip to content

Instantly share code, notes, and snippets.

@appspell
Created Mar 4, 2021
Embed
What would you like to do?
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