Skip to content

Commit 30df2f1

Browse files
joliver82Ali-RS
authored andcommitted
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
1 parent 48f2897 commit 30df2f1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public void initialize() {
612612
int vaoId = intBuf16.get(0);
613613
gl3.glBindVertexArray(vaoId);
614614
}
615-
if (gl2 != null) {
615+
if (gl2 != null && !(gl instanceof GLES_30)) {
616616
gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE);
617617
if (!caps.contains(Caps.CoreProfile)) {
618618
gl2.glEnable(GL2.GL_POINT_SPRITE);

jme3-core/src/main/resources/Common/ShaderLib/MorphAnim.glsllib

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ A glsllib that perform morph animation.
33
Note that it only handles morphing position, normals and tangents.
44
*/
55
#ifdef NUM_MORPH_TARGETS
6-
vec3 dummy_norm = vec3(0.0);
7-
vec3 dummy_tan = vec3(0.0);
86
#define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS
97
#if (NUM_BUFFERS > 0)
108
uniform float m_MorphWeights[NUM_MORPH_TARGETS];
@@ -98,7 +96,7 @@ Note that it only handles morphing position, normals and tangents.
9896
}
9997

10098
float Get_Inverse_Weights_Sum(){
101-
float sum = 0;
99+
float sum = 0.0;
102100
for( int i = 0;i < NUM_MORPH_TARGETS; i++){
103101
sum += m_MorphWeights[i];
104102
}
@@ -175,10 +173,10 @@ Note that it only handles morphing position, normals and tangents.
175173

176174
void Morph_Compute(inout vec4 pos){
177175
#if (NUM_TARGETS_BUFFERS == 2)
178-
Morph_Compute_Pos_Norm(pos,dummy_norm);
176+
Morph_Compute_Pos_Norm(pos,vec3(0.0));
179177
return;
180178
#elif (NUM_TARGETS_BUFFERS == 3)
181-
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan);
179+
Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0));
182180
return;
183181
#endif
184182
Morph_Compute_Pos(pos);
@@ -189,7 +187,7 @@ Note that it only handles morphing position, normals and tangents.
189187
Morph_Compute_Pos(pos);
190188
return;
191189
#elif (NUM_TARGETS_BUFFERS == 3)
192-
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan);
190+
Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0));
193191
return;
194192
#elif (NUM_TARGETS_BUFFERS == 2)
195193
Morph_Compute_Pos_Norm(pos, norm);

0 commit comments

Comments
 (0)