I increased the size of the object using the ScaleM(modelMatrix, offset, x, y, z) method:
...
protected val projectionMatrix = FloatArray(16)
protected val modelMatrix = FloatArray(16)
protected val modelViewMatrix = FloatArray(16)
protected val mvpMatrix = FloatArray(16)
...
Matrix.setIdentityM(modelMatrix, 0)
Matrix.translateM(modelMatrix, 0, 1.0f, 0.0f, 100.0f)
Matrix.rotateM(modelMatrix, 0, angle, 0.0f, 0.5f, 0.0f)
Matrix.scaleM(modelMatrix, 0, 15f, 15f, 15f) // enlarge object
Matrix.multiplyMM(modelViewMatrix, 0, viewMatrix, 0, modelMatrix, 0)
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, modelViewMatrix, 0)
...
The object increased but this affected its display (Illumination increased and iridescence decreased in my case). Is there an easy way to avoid this, or do I need to reconfigure the shader and input parameters for it?
Thanks in advance!
Maybe there is a better option, but I found the following solution:
private val modelViewMatrixForShader = FloatArray(16)
...
Matrix.translateM(modelMatrix, 0, 0.0f, 0.0f, -100.0f)
Matrix.rotateM(modelMatrix, 0, angle, 0.0f, 0.5f, 0.0f)
Matrix.multiplyMM(modelViewMatrixForShader, 0, viewMatrix, 0, modelMatrix, 0)
Matrix.scaleM(modelMatrix, 0, 15f, 15f, 15f)
Matrix.multiplyMM(modelViewMatrix, 0, viewMatrix, 0, modelMatrix, 0)
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, modelViewMatrix, 0)
...
fun getMVMatrixAsFloatBuffer(): FloatBuffer = floatBuffer(modelViewMatrixForShader)
...
GLES20.glUniformMatrix4fv(mvMatrixLink, 1, false,
view.getMVMatrixAsFloatBuffer());