From 30df2f1b87f38529c0958776b57c8ba9d68d2992 Mon Sep 17 00:00:00 2001 From: joliver82 <39382046+joliver82@users.noreply.github.com> Date: Sun, 24 Nov 2019 06:50:09 +0100 Subject: [PATCH] Android morph fix (#1221) * Fixed MorphAnim.glsllib to compile on android and avoid enabling GL_VERTEX_PROGRAM_POINT_SIZE in android as it's not supported --- .../main/java/com/jme3/renderer/opengl/GLRenderer.java | 2 +- .../main/resources/Common/ShaderLib/MorphAnim.glsllib | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index d20c78b30..3f22c4096 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -612,7 +612,7 @@ public final class GLRenderer implements Renderer { int vaoId = intBuf16.get(0); gl3.glBindVertexArray(vaoId); } - if (gl2 != null) { + if (gl2 != null && !(gl instanceof GLES_30)) { gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE); if (!caps.contains(Caps.CoreProfile)) { gl2.glEnable(GL2.GL_POINT_SPRITE); diff --git a/jme3-core/src/main/resources/Common/ShaderLib/MorphAnim.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/MorphAnim.glsllib index 68c26f4ae..b6c64f1ad 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/MorphAnim.glsllib +++ b/jme3-core/src/main/resources/Common/ShaderLib/MorphAnim.glsllib @@ -3,8 +3,6 @@ A glsllib that perform morph animation. Note that it only handles morphing position, normals and tangents. */ #ifdef NUM_MORPH_TARGETS - vec3 dummy_norm = vec3(0.0); - vec3 dummy_tan = vec3(0.0); #define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS #if (NUM_BUFFERS > 0) uniform float m_MorphWeights[NUM_MORPH_TARGETS]; @@ -98,7 +96,7 @@ Note that it only handles morphing position, normals and tangents. } float Get_Inverse_Weights_Sum(){ - float sum = 0; + float sum = 0.0; for( int i = 0;i < NUM_MORPH_TARGETS; i++){ sum += m_MorphWeights[i]; } @@ -175,10 +173,10 @@ Note that it only handles morphing position, normals and tangents. void Morph_Compute(inout vec4 pos){ #if (NUM_TARGETS_BUFFERS == 2) - Morph_Compute_Pos_Norm(pos,dummy_norm); + Morph_Compute_Pos_Norm(pos,vec3(0.0)); return; #elif (NUM_TARGETS_BUFFERS == 3) - Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); + Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0)); return; #endif Morph_Compute_Pos(pos); @@ -189,7 +187,7 @@ Note that it only handles morphing position, normals and tangents. Morph_Compute_Pos(pos); return; #elif (NUM_TARGETS_BUFFERS == 3) - Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); + Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0)); return; #elif (NUM_TARGETS_BUFFERS == 2) Morph_Compute_Pos_Norm(pos, norm);