Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.66 KB | None | 0 0
  1. float[] modelViewMatrixKeyframe2 = Tool.convertPose2GLMatrix(trackableResult.getPose()).getData();
  2. float[] modelViewProjectionKeyframe2 = new float[16];
  3.  
  4. Matrix.translateM(
  5.         modelViewMatrixKeyframe2, 0,
  6.         config.get("color_x").floatValue() + config.get("color_space_h").floatValue() * (i % config.get("color_number_in_line").intValue()),
  7.         config.get("color_y").floatValue() + config.get("color_space_v").floatValue() * (i / config.get("color_number_in_line").intValue()),
  8.         config.get("color_z").floatValue()
  9. );
  10. Matrix.rotateM(modelViewMatrixKeyframe2, 0, 270, 0, 0, 1);
  11. Matrix.rotateM(modelViewMatrixKeyframe2, 0, 90, 1, 0, 0);
  12. Matrix.rotateM(modelViewMatrixKeyframe2, 0, 90, 0, 1, 0);
  13. Matrix.scaleM(modelViewMatrixKeyframe2, 0, config.get("color_scale").floatValue(), config.get("color_scale").floatValue(), config.get("color_scale").floatValue());
  14.  
  15. Matrix.multiplyMM(modelViewProjectionKeyframe2, 0, vuforiaAppSession.getProjectionMatrix().getData(), 0, modelViewMatrixKeyframe2, 0);
  16.  
  17. Matrix44F matrix44F = new Matrix44F();
  18. matrix44F.setData(modelViewMatrixKeyframe2);
  19. modelViewMatrix_colors.put(colors_list.get(i).getSet_id() + "_" + colors_list.get(i).getId(), matrix44F);
  20.  
  21. GLES20.glUseProgram(keyframeShaderID);
  22.  
  23. GLES20.glEnableVertexAttribArray(keyframeVertexHandle);
  24. //GLES20.glEnableVertexAttribArray(keyframeNormalHandle);
  25. GLES20.glEnableVertexAttribArray(keyframeTexCoordHandle);
  26.  
  27. // Prepare for rendering the keyframe
  28. GLES20.glVertexAttribPointer(keyframeVertexHandle, 3, GLES20.GL_FLOAT, false, 0, fillBuffer(ArrayUtils.toPrimitive(Verts_colors.toArray(new Double[Verts_colors.size()]))));
  29. //GLES20.glVertexAttribPointer(keyframeNormalHandle, 3, GLES20.GL_FLOAT, false, 0, fillBuffer(ArrayUtils.toPrimitive(Normals.toArray(new Double[Normals.size()]))));
  30. GLES20.glVertexAttribPointer(keyframeTexCoordHandle, 2, GLES20.GL_FLOAT, false, 0, fillBuffer(ArrayUtils.toPrimitive(TexCoords_colors.toArray(new Double[TexCoords_colors.size()]))));
  31.  
  32. GLES20.glEnable(GLES20.GL_BLEND);
  33. GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
  34.  
  35. GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
  36. GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colors_texture.get(colors_list.get(i).getId()).mTextureID[0]);
  37. GLES20.glUniformMatrix4fv(keyframeMVPMatrixHandle, 1, false, modelViewProjectionKeyframe2, 0);
  38. GLES20.glUniform1i(keyframeTexSampler2DHandle, 0);
  39. GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, NumVerts_colors);
  40.  
  41. GLES20.glDisable(GLES20.GL_BLEND);
  42.  
  43. GLES20.glDisableVertexAttribArray(keyframeVertexHandle);
  44. //GLES20.glDisableVertexAttribArray(keyframeNormalHandle);
  45. GLES20.glDisableVertexAttribArray(keyframeTexCoordHandle);
  46.  
  47. GLES20.glUseProgram(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement