I used the old sdk manager that works with JME, enabled android deployment, and turned off compile on save. No .APK is generated in the dist folder, and when I try to run using the “Android Device” configuration, i get this message:
Target "run-android" does not exist in the project "Crushed".
BUILD FAILED (total time: 0 seconds)
My guess is I need to add a new target to the build file, but I have no idea what to put there.
I don’t think this matters, but I’m targeting Android 7.0(API 24 i think)
I seem to have hit problems using the lighting shader. Is there another way to achieve this? My game 100% depends on shadows(the things trying to kill you are way above you, it’s the warning system.)
E/AndroidRuntime: FATAL EXCEPTION: GLThread 591
Process: com.indigoa.android.crushed, PID: 9501
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PostShadow.frag, defines, type=Fragment, language=GLSL100]
ERROR: 0:77: 'sampler2DShadow' : Reserved word.
ERROR: 0:77: 'sampler2DShadow' : Syntax error: syntax error
INTERNAL ERROR: no main() function!
ERROR: 2 compilation errors. No code generated.
at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1200)
at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1227)
at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1291)
at com.jme3.material.logic.DefaultTechniqueDefLogic.render(DefaultTechniqueDefLogic.java:94)
at com.jme3.material.Technique.render(Technique.java:166)
at com.jme3.material.Material.render(Material.java:968)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:600)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
at com.jme3.renderer.queue.RenderQueue.renderShadowQueue(RenderQueue.java:275)
at com.jme3.shadow.AbstractShadowRenderer.postFrame(AbstractShadowRenderer.java:495)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1102)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1145)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
at com.jme3.app.AndroidHarness.update(AndroidHarness.java:497)
at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1593)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1289)
E/com.jme3.app.AndroidHarness: SEVERE Exception thrown in Thread[GLThread 591,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PostShadow.frag, defines, type=Fragment, language=GLSL100]
ERROR: 0:77: ‘sampler2DShadow’ : Reserved word.
ERROR: 0:77: ‘sampler2DShadow’ : Syntax error: syntax error
INTERNAL ERROR: no main() function!
ERROR: 2 compilation errors. No code generated.
at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1200)
at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1227)
at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1291)
at com.jme3.material.logic.DefaultTechniqueDefLogic.render(DefaultTechniqueDefLogic.java:94)
at com.jme3.material.Technique.render(Technique.java:166)
at com.jme3.material.Material.render(Material.java:968)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:600)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
at com.jme3.renderer.queue.RenderQueue.renderShadowQueue(RenderQueue.java:275)
at com.jme3.shadow.AbstractShadowRenderer.postFrame(AbstractShadowRenderer.java:495)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1102)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1145)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
at com.jme3.app.AndroidHarness.update(AndroidHarness.java:497)
at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:336)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1593)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1289)
Album has comparison of with/without DirectionalLightShadowRenderer(so you can see why I need it.)
Edit: Could I copy the PostShadow.frag file and just rename the variable on all occurances?
Edit#2: My phone also seems to ignore app.settings.setFrameRate(30);
All I should need to do is copy the entire code of DLSR and ASR, and change the location of the post processing shader in the ASR to my new one which is exactly the same, but without the conflicting variable name.
P.S. How do you manage any silver-like colors using Unshaded materials?
Well I couldn’t find ‘sampler2DShadow’ in PostShadow.frag, PreShadow.frag, BasicPostShadow.frag, or Phadow.vert(I was getting desprate), so I assume it’s in
Any Ideas/workarounds? I guess I could always make some bitmaps and render them on the ground as a shadow.
FPS Fix:
define counter as an integer
new Thread(() -> {
while (counter > -1) {
try {
Thread.sleep(1000/30); // MY Framerate(or updaterate I guess) is 30fps
counter++;
} catch (InterruptedException e) {}
}}).start();
In your AppState’s init method.
public int updateCounter() {
int c = counter;
counter = 0;
return c;
}
@Override
public void update(float tpf) {
int uc = updateCounter();
for (int i = 0; i < uc; i++) {
// Your update stuff that needs to be repeatedly fired(game logic, entity updates, Etc...)
}
//Your updates that don't need to be repeatedly fired(UI, Guis, Hud, Etc...)
}