I have an android app and I am using Huawei AR Engine Kit.
I have a model file with the .obj extension. When I add this file to my application after reducing its size in the application called blender, my model does not appear properly. I add them as assets in the Android project. I export the model properly because I checked it where necessary and my model is correct.
I want to resize the model and show it in a smaller size.
I shared what the model actually is and the screenshot in the application below.
onDrawFrame is as follows
public void onDrawFrame(float[] cameraView, float[] cameraProjection, float lightIntensity, VirtualObject obj) {
ShaderUtil.checkGlError(TAG, "onDrawFrame start.");
mModelMatrixs = obj.getModelAnchorMatrix();
Matrix.multiplyMM(mModelViewMatrixs, 0, cameraView, 0, mModelMatrixs, 0);
Matrix.multiplyMM(mModelViewProjectionMatrixs, 0, cameraProjection, 0, mModelViewMatrixs, 0);
GLES20.glUseProgram(mGlProgram);
Matrix.multiplyMV(mViewLightDirections, 0, mModelViewMatrixs, 0, LIGHT_DIRECTIONS, 0);
MatrixUtil.normalizeVec3(mViewLightDirections);
GLES20.glUniform4f(mLightingParametersUniform,
mViewLightDirections[0], mViewLightDirections[1], mViewLightDirections[2], lightIntensity);
float[] objColors = obj.getColor();
GLES20.glUniform4fv(mColorUniform, 1, objColors, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextures[0]);
GLES20.glUniform1i(mTextureUniform, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mVertexBufferId);
GLES20.glVertexAttribPointer(
mPositionAttribute, 3, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glVertexAttribPointer(
mNormalAttribute, 3, GLES20.GL_FLOAT, false, 0, mNormalsBaseAddress);
GLES20.glVertexAttribPointer(
mTexCoordAttribute, 2, GLES20.GL_FLOAT, false, 0, mTexCoordsBaseAddress);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
GLES20.glUniformMatrix4fv(
mModelViewUniform, 1, false, mModelViewMatrixs, 0);
GLES20.glUniformMatrix4fv(
mModelViewProjectionUniform, 1, false, mModelViewProjectionMatrixs, 0);
GLES20.glEnableVertexAttribArray(mPositionAttribute);
GLES20.glEnableVertexAttribArray(mNormalAttribute);
GLES20.glEnableVertexAttribArray(mTexCoordAttribute);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, mIndexBufferId);
GLES20.glDrawElements(GLES20.GL_TRIANGLES, mIndexCount, GLES20.GL_UNSIGNED_SHORT, 0);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
GLES20.glDisableVertexAttribArray(mPositionAttribute);
GLES20.glDisableVertexAttribArray(mNormalAttribute);
GLES20.glDisableVertexAttribArray(mTexCoordAttribute);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
ShaderUtil.checkGlError(TAG, "onDrawFrame end.");
}