www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: Andrey8000 on April 16, 2013, 04:56:08 pm
-
Hi all, I like jPCT, but now I was faced with how to make live wallpaper using jPCT? For example, I tried to combine the example of Robert Green and the standard example of a working code android, jPCT and so far I do not have enough understanding of the problem. For example now I get an error nullpointer in the method onSurfaceCreated() (class myEngine extends GLEngine)... Can anyone share the sample code of jpct livewallpaper? p.s. Sorry by my english.
-
Maybe you can post the exception and the code that causes it!?
-
Ok, I learned how to do it. I took this solution http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers and combined it with jPCT-ae code, replacing the "renderer" and some small details.
p.s. Thank you for jPCT-ae
-
Hi. I have a new question.
When the live Wallpapers have 2 copies of the renderer (for example the one on the desktop, and the second - in the menu select the Wallpaper), then there is a little bug, as if to shake and at the moment shows a scene from the other instance Wallpaper (other positions 3D objects).
I tried to do renderer a static class, but in this case, when you try to create the 2nd copy is that it turns out incorrect, with the curves of objects and without textures.
I tried to do engine a static class - but it is not good too.
Does anyone else have thoughts on this? Or can code examples?
-
And one more question. On the emulator, I get this error when I install after watching the live wallpaper on the screen. What could this mean?
04-27 05:55:35.044: E/SurfaceTextureClient(724): queueBuffer: error queuing buffer to SurfaceTexture, -19
04-27 05:55:35.064: E/EGL_emulation(724): tid 824: swapBuffers(322): error 0x3003 (EGL_BAD_ALLOC)
04-27 05:55:35.144: A/libc(724): Fatal signal 11 (SIGSEGV) at 0x0000003c (code=1), thread 824 (Thread-96)
04-27 05:55:43.134: E/Trace(829): error opening trace file: No such file or directory (2)
-
To be honest, i'm not sure what you are talking about. What exactly is a 'renderer' in this case? Have you tried to synchronize you renderers....whatever they are...!?
-
renderer is:
...
public class WallpaperService extends GLWallpaperService {
...
...
public void onCreate(){
Log.d(LOGTAG, "Load textures here");
myTex mTex = new myTex(getResources());
}
...
...
public Engine onCreateEngine() {
MyEngine engine = new MyEngine();
return engine;
}
class MyEngine extends GLEngine {
MyRenderer renderer;
public MyEngine() {
super();
renderer = new MyRenderer();
setRenderer(renderer);
}
...
...
and:
class MyRenderer implements GLSurfaceView.Renderer {
private FrameBuffer fb = null;
private RGBColor back = new RGBColor(0, 0, 0);
public MyRenderer() {
Log.d(LOGTAG,"Create scene here");
createWorld();
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
Log.d(LOGTAG,"SurfaseChanged()");
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer( gl, w, h);
// no need to rebuild world, it cost a lot of time
}
...
...
How i understand Wallpaper Service is designed so that if the wallpaper is already installed - then we get new renderer in preview (for example, when we want to change the settings)... and some bugs
-
I think we had this issue before. Somehow, both wallpapers are running in parallel. The solution should be somewhere in the forum, but i can't really search for it, because i'm on a very slow mobile connection for this week.
-
A little more about the problem: the bug looks like a short-term (may be 1-2 frames) collapsing objects, short-term movement of objects in other places and back, short-term change in the scale of objects.
-
As said: There should be a thread dealing with this problem. IIRC, the solution was to not let the preview renderer render anything as long as the normal one hasn't really stopped.