From 3992ed89af398fa525bc16a3781f11f96f226ef0 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Wed, 5 Nov 2014 23:50:09 -0500 Subject: [PATCH] Fix point sprite on Android. Fixes issue #82. --- .../src/main/resources/Common/MatDefs/Misc/Particle.frag | 6 ++++++ .../src/main/resources/Common/MatDefs/Misc/Particle.j3md | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag index 6dff8ac68..0b4875e2d 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag @@ -1,3 +1,9 @@ +#ifdef POINT_SPRITE +# if !defined(GL_ES) && __VERSION__ < 120 +# error Point sprite is not supported by the video hardware! +# endif +#endif + #ifdef USE_TEXTURE uniform sampler2D m_Texture; varying vec4 texCoord; diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md index c6116fa83..a327f43b9 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md @@ -32,7 +32,6 @@ MaterialDef Point Sprite { Blend AlphaAdditive DepthWrite Off PointSprite On - // AlphaTestFalloff 0.01 } Defines { @@ -43,6 +42,12 @@ MaterialDef Point Sprite { Technique { + // This technique is used in two cases: + // - When the driver doesn't support GLSL 1.2 + // - When running on OpenGL ES 2.0 + // Point sprite should be used if running on ES2, but crash + // if on desktop (because its not supported by HW) + VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag @@ -56,10 +61,12 @@ MaterialDef Point Sprite { RenderState { Blend AlphaAdditive DepthWrite Off + PointSprite On } Defines { USE_TEXTURE : Texture + POINT_SPRITE : PointSprite } }