Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - kkl

Pages: 1 ... 16 17 [18] 19 20
Support / Re: Black texture loading .3ds model
« on: May 06, 2013, 05:11:44 pm »
Hi Egon, I think I found the solution.

These are the following steps I did:
1. Create object
2. Open uv/image editor to open image in object editor mode. (I think this part does the texture coord mapping)
3. Set material and texture for the object by opening the same image (I think this part creates the texture name in order to link the texture name to TextureManager in JPCT, but not texture coord mapping)
4. Export the 3ds, and there, it worked!

I'm not sure if I'm doing it correctly, but somehow it worked! Hope this would help the rest of developers who have the same problem too ; )

Support / Re: Black texture loading .3ds model
« on: May 06, 2013, 03:58:46 am »
Ok. I've attached 3ds file and a snapshot from Blender.

[attachment deleted by admin]

Support / Black texture loading .3ds model
« on: May 05, 2013, 05:25:05 pm »
Hi Egon,

When I tried to load 3ds model into jpct-ae, it showed the 3D object with black texture. Did I miss something? I did exactly like in JPCT wiki tutorial. I'm using Blender 2.66a to export the 3ds. If I call calcTextureWrapSpherical(), the texture shows. Unfortunately, I want it to follow the texture mapping in 3ds instead of jpct texture wrapping.

Code: [Select]
try {
Object3D obj = load3DSModel(context.getAssets().open("monkey.3ds"), 20);
} catch (IOException e) {
Log.e("kkl", "Error reading 3ds", e);

private Object3D load3DSModel(InputStream is, float scale) {
Object3D[] model = Loader.load3DS(is, scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.rotateX((float) (-.5 * Math.PI));
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);;
return o3d;

Code: [Select]
05-05 23:23:04.348: I/jPCT-AE(15498): Loading file from InputStream
05-05 23:23:04.348: I/jPCT-AE(15498): Expanding buffers...16384 bytes
05-05 23:23:04.348: I/jPCT-AE(15498): File from InputStream loaded...16026 bytes
05-05 23:23:04.348: I/jPCT-AE(15498): Processing new material leafmat!
05-05 23:23:04.353: I/jPCT-AE(15498): Processing object from 3DS-file: Suzanne
05-05 23:23:04.418: I/jPCT-AE(15498): Object 'Suzanne_jPCT0' created using 968 polygons and 505 vertices.
05-05 23:23:04.468: I/jPCT-AE(15498): Normal vectors calculated in 37ms!
05-05 23:23:04.468: I/jPCT-AE(15498): Memory usage before compacting: 19105 KB used out of 19783 KB. Max. memory available to the VM is 49152 KB.
05-05 23:23:04.683: I/jPCT-AE(15498): Memory usage after compacting: 14468 KB used out of 19783 KB. Max. memory available to the VM is 49152 KB.
05-05 23:23:04.763: I/jPCT-AE(15498): Subobject of object 2/monkey compiled to indexed fixed point data using 2904/505 vertices in 55ms!
05-05 23:23:04.763: I/jPCT-AE(15498): Object 2/monkey compiled to 0 subobjects in 77ms!

Support / Re: Error in live wallpaper
« on: May 05, 2013, 10:52:41 am »
Thanx Egon. I think unload() should help alot. However, I still hope that I could reuse the texture without unloading them, so the live wallpaper does not have to upload the texture again (Uploading texture might cause the livewallpaper freezes for awhile). Anyway, I'm suspecting if I don't unload the texture, the gl context might be still pointing to the texture and gl context cannot be collected by gc, then causes memory leak. Will find better solution if possible.

K24A3, thanx for the suggestion. BTW, if we destroy the existing one before creating one, the existing one might resume ( onResume() ) its own wallpaper after quitting the preview livewallpaper. Presumably, It might cause error as the existing one is destroyed after viewing the preview. Perhaps I still don't quite know very much about android wallpaper service behavior yet about destroying the previous livewallpaper. Hope you would explain more ;)

Support / Re: Error in live wallpaper
« on: May 03, 2013, 05:02:47 am »
I'm not sure how to synchronize both render as they are totally different instance, but I did find out what happened to the error after debugging for few days. The textures uploaded are static in gpu (I assume). If I don't flush the textures, it works perfectly. Probably because I'm re-using the textures from current wallpaper for the preview in settings (to avoid out-of-memory issue). So I can't flush the textures in wallpaper preview if my wallpaper's already running at home screen (but I do dispose frame buffer and world). However, if I open the wallpaper preview and set the wallpaper to the phone repeatedly (around 5 times), it shows out of memory error. I suspect the textures may be still referencing to frame buffer and world, even when disposing them, they are not collected by gc. Any idea how to solve it?

Code: [Select]
public void onCreate(SurfaceHolder surfaceHolder) {

public void onDestroy() {
WallpaperManager wpm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
WallpaperInfo info = wpm.getWallpaperInfo();
if (info != null && info.getComponent().equals(new ComponentName(FireFliesForestWallpaperService.this,
FireFliesForestWallpaperService.this.getClass()))) {
} else {
Log.v("kkl", "Destroyed!");

          public void init(){
world = new World();
world.setAmbientLight(50, 50, 220);

Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50f);
cam.lookAt(new SimpleVector(0, 0, 0));

createAllObjects(world); //creates all 3D objects and add them to world

world.setFogParameters(50f, 120f, 0, 0, 0);

public void safeCreateAllTextures() {
if (TextureManager.getInstance().containsTexture(TextureId.TREE_LEAF_1)) {
Log.v("kkl", "Textures exist. Not creating textures..");
createAllTextures(); //adds textures to TextureManager and disposes the bitmaps

        //When renderer.dispose() is called
        public void onDisposed() {

public void clearObjects() {
if (world != null) {
world = null;
if (frame != null) {
frame = null;

public void clearTextures(){

Support / Error in live wallpaper
« on: April 29, 2013, 06:27:12 pm »
Hi Egon, I got strange error after I viewed my live wallpaper in live wallpaper settings. It seems like some objects are bound statically. After disposing frame and world (after quiting the settings), the running live wallpaper received an error like the following.

Code: [Select]
04-30 00:07:20.167: E/AndroidRuntime(13968): FATAL EXCEPTION: GLThread 31292
04-30 00:07:20.167: E/AndroidRuntime(13968): java.lang.NullPointerException
04-30 00:07:20.167: E/AndroidRuntime(13968): at com.threed.jpct.GLRenderer.drawVertexArray(
04-30 00:07:20.167: E/AndroidRuntime(13968): at com.threed.jpct.World.draw(
04-30 00:07:20.167: E/AndroidRuntime(13968): at com.threed.jpct.World.draw(
04-30 00:07:20.167: E/AndroidRuntime(13968): at com.kision.firefliesforest.MainRenderer.draw(
04-30 00:07:20.167: E/AndroidRuntime(13968): at com.kision.firefliesforest.BasicRenderer.onDrawFrame(
04-30 00:07:20.167: E/AndroidRuntime(13968): at
04-30 00:07:20.167: E/AndroidRuntime(13968): at

Steps to reproduce:
1. Set my live wallpaper to phone.
2. Goto Live Wallpaper settings (the place where you select your live wallpaper), view the preview of my live wallpaper.
3. Quit the preview and then Live Wallpaper settings.
4. When screen goes back to home screen, the running live wallpaper in phone receives error.

Is it a bug or I did it wrong? Are JPCT objects created and disposed statically? 

Support / Re: Emissive light
« on: April 26, 2013, 06:32:37 pm »
Thanks Egon ;) I guess that should work similarly to the one I am looking for.

Support / Emissive light
« on: April 23, 2013, 10:45:41 am »
Hi Egon,

Does JPCT have emissive light? as in light inside object, like this one; the last column of the spheres

Support / Re: FrameBuffer resize
« on: February 11, 2013, 02:51:16 pm »
Well~ It's not really a problem though... I think it works perfectly... Just that if I could adjust manually for viewport, it would be easier for me to develop android app in pc (like game engine). It's ok.. I'll just use whatever available.. Thanx alot ;)

Support / Re: FrameBuffer resize
« on: February 07, 2013, 04:25:59 pm »
Yea. I guess I'm using the wrong way to do it. Any good suggestion for that case? Perhaps changing the viewport and adjust yFov manually?

p/s: The fix works. Now I see the "Choose file" option.

Support / Re: FrameBuffer resize
« on: February 06, 2013, 01:27:43 pm »
I posted the drawings in JPCT-android forum anyway~

The first image is the one I would like achieve while the second image is the one without framebuffer resizing.

Support / Re: Multiple screen size issue
« on: February 06, 2013, 01:23:50 pm »
Attachments only~

[attachment deleted by admin]

Support / Re: FrameBuffer resize
« on: February 06, 2013, 09:56:31 am »
I tried to upload some pics, but it doesn't hav the attachment option to upload in the new forum. ;( There is "Choose file" option in jpct android forum though.

Support / Re: FrameBuffer resize
« on: February 06, 2013, 08:10:52 am »
Yea. The reason I'm doing that is to simulate android live wallpaper in pc so that object's scale factor and location stays the same in both platforms for easier development. The resized buffer represents the device screen while outside of boundary represents the entire live wallpaper. I tried simulating it by changing camera frustum, but I'm not sure how. Perhaps I'm not doing right? Or is there any alternative? Thanks.

Support / FrameBuffer resize
« on: February 05, 2013, 04:48:18 pm »
Hi I'm trying to resize the framebuffer from (800, 600) to (360, 600), but any object located outside of (360, 600) bound is clipped. Is it possible to resize the framebuffer while objects are still displayed beyond the resized bound?

Pages: 1 ... 16 17 [18] 19 20