Pro Android with Kotlin


CHAPTER 9: User Interface


Download 5.42 Mb.
Pdf ko'rish
bet192/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   188   189   190   191   192   193   194   195   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile



240
CHAPTER 9: User Interface
GLES20.glVertexAttribPointer(normHandle,
COORDS_PER_VERTEX,
GLES20.GL_FLOAT, false,
VERTEX_STRIDE, normBuffer)
}
// get handle to vertex shader's textureCoords
vertexBuffer.position(COORDS_PER_VERTEX +
NORMS_PER_VERTEX)
val textureBuffer = vertexBuffer.slice()
// create a new view
vertexBuffer.rewind()
// ... and rewind the original buffer
val textureHandle =
GLES20.glGetAttribLocation(program,
"vTexture")
if(textureHandle >= 0) {
// Enable a handle to the texture coords
GLES20.glEnableVertexAttribArray(
textureHandle)
// Prepare the coordinate data
GLES20.glVertexAttribPointer(textureHandle,
COORDS_PER_VERTEX,
GLES20.GL_FLOAT, false,
VERTEX_STRIDE, textureBuffer)
}
// get handle to vertex shader's vColor member
vertexBuffer.position(COORDS_PER_VERTEX +
NORMS_PER_VERTEX + TEXTURE_PER_VERTEX)
val colorBuffer = vertexBuffer.slice()
// create a new view
vertexBuffer.rewind()
// ... and rewind the original buffer
val colorHandle =
GLES20.glGetAttribLocation(program, "vColor")
if(colorHandle >= 0) {
// Enable a handle to the vertices
GLES20.glEnableVertexAttribArray(colorHandle)
// Prepare the coordinate data
GLES20.glVertexAttribPointer(colorHandle,
COLORS_PER_VERTEX,
GLES20.GL_FLOAT, false,
VERTEX_STRIDE, colorBuffer)
}
textureUniformHandle =
GLES20.glGetUniformLocation(program,
"texture")
if(textureHandle >= 0) {
// Set the active texture unit to
// texture unit 0.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0)
// Tell the texture uniform sampler to use



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   188   189   190   191   192   193   194   195   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling