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.


Topics - Raswr

Pages: [1]
1
Support / Context change
« on: June 05, 2013, 09:31:42 pm »
So I'm getting a crash on my app after pressing home and going back into it,

Code: [Select]
06-05 21:23:37.915: E/AndroidRuntime(28038): FATAL EXCEPTION: GLThread 43544
06-05 21:23:37.915: E/AndroidRuntime(28038): java.lang.NullPointerException
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2157)
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.World.draw(World.java:1344)
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.World.draw(World.java:1085)

I've been searching but haven't found what I have to do exactly to manage gl context changes. Is the solution to load all the models from the files (serialized) again? and same goes for the textures? I thought the engine would manage re-upload of vbos and textures to the gpu, but now I don't really know, the info is a bit confusing to me.



Thank you.


2
Support / Some questions about octrees & collision detection
« on: February 27, 2013, 04:12:03 pm »
Hello again  :)

I've been playing with collision detection octrees lately, they are quite interesting structures. This is going to be more of a learning thread, not a technical question. I have a big terrain (2500 triangles) and asigned a 10 depth octree to it (collision mode only). I was amazed at how fast it tests collision using sphere collision on my character. When I get close to that terrain, fps only fall from 57/58 to around 54 or 56 with such a big structure, especially on a phone!. It would be nice to know how this works a bit more (maybe not a completely jpct-ae related question, if it doesn't belong here, i'm sorry, just delete it).

I've been reading about octrees and they recursively subdivide a bigger space in the shape of 8 cubes/bounding boxes. But how can the collision detection system calculate this so fast? I mean, a 10depth octree can get really complex and testing against 8 nodes at every tree level should damage performance by a lot. I guess there are some optimizations but still, I can't believe that these sphere vs triangle collisions are calculating so fast on such a big mesh. Also, given a certain mesh, is there a method to know the optimal depth/max polys for the octree?  I would appreciate any insight on this topic, I'm really curious at how this works :o

3
Support / Texture size crash on Android 4.2.1 (Nexus4)
« on: February 06, 2013, 02:18:03 pm »
Hi!

I recently switched to a Nexus 4 phone with Android 4.2.1 and i'm getting some weird crashes while loading textures. All my textures are square of 2 size, but I'm getting errors like these when executing Texture aux=new Texture(res.getDrawable(id),alpha); and after that activity stops

256x256 size texture:

Code: [Select]
02-06 14:05:26.487: I/jPCT-AE(17562): Loading Texture...
02-06 14:05:26.487: I/jPCT-AE(17562): [ 1360155926496 ] - ERROR: Unsupported Texture width: 341
02-06 14:05:26.487: I/jPCT-AE(17562): [ 1360155926500 ] - ERROR: java.lang.RuntimeException: [ 1360155926496 ] - ERROR: Unsupported Texture width: 341
02-06 14:05:26.487: I/jPCT-AE(17562): at com.threed.jpct.Logger.log(Logger.java:189)
02-06 14:05:26.487: I/jPCT-AE(17562): at com.threed.jpct.Texture.loadTexture(Texture.java:798)
02-06 14:05:26.487: I/jPCT-AE(17562): at com.threed.jpct.Texture.<init>(Texture.java:198)
02-06 14:05:26.487: I/jPCT-AE(17562): at com.threed.jpct.Texture.<init>(Texture.java:234)

128x128 texture:

Code: [Select]
02-06 14:09:46.624: I/jPCT-AE(18345): [ 1360156186637 ] - ERROR: Unsupported Texture width: 171
02-06 14:09:46.624: I/jPCT-AE(18345): [ 1360156186639 ] - ERROR: java.lang.RuntimeException: [ 1360156186637 ] - ERROR: Unsupported Texture width: 171
02-06 14:09:46.624: I/jPCT-AE(18345): at com.threed.jpct.Logger.log(Logger.java:189)
02-06 14:09:46.624: I/jPCT-AE(18345): at com.threed.jpct.Texture.loadTexture(Texture.java:798)
02-06 14:09:46.624: I/jPCT-AE(18345): at com.threed.jpct.Texture.<init>(Texture.java:198)
02-06 14:09:46.624: I/jPCT-AE(18345): at com.threed.jpct.Texture.<init>(Texture.java:234)

Some more info that appears on my logcat

Code: [Select]
02-06 14:15:53.186: I/jPCT-AE(18762): GL20 render pipeline initialized!
02-06 14:15:53.186: I/jPCT-AE(18762): OpenGL vendor:     Qualcomm
02-06 14:15:53.186: I/jPCT-AE(18762): OpenGL renderer:   Adreno (TM) 320
02-06 14:15:53.186: I/jPCT-AE(18762): OpenGL version:    OpenGL ES 2.0 V@6.0 AU@ (CL@2946718)
02-06 14:15:53.186: I/jPCT-AE(18762): OpenGL renderer initialized (using 2 texture stages)


Last time I tested my app on my Samsung Galaxy S plus it worked fine, now a relative has that phone so i can't test it again in it until tonight! Any ideas?

Thanks :)

4
Support / Replacing an Object3D model
« on: January 16, 2013, 07:53:22 pm »
Here I come with a new question!  :P

I have a class that extends Object3D and implements a collision listener. I want to do the following: when the player crashes against this object3D, it must replace the 3D model it's showing, to represent a broken object. I only want the model+texture coordinates to change, I want to keep the texture file it's using, position, rotation, shader, etc. (as it's the same 3D model but broken down)

This object3D extension implements the listener collision(CollisionEvent arg0). Is it possible to change the model of this Object3D from that method? setMesh doesn't seem to do the trick and I read on another post that it doesn't pass texture coordinates so my only option would be to create a new Object3D cloning the one in my model pool, remove the old one from the World and insert the new one, but this collision listener function is inside the Object3D I would have to remove so i'm a bit confused on how to do this.

If there's no other way I'll have to manually set a boolean on this object and make an external class (world) check it and replace this object. But I prefer to ask here before doing those things! :)

Any help would be appreciated  ;)


5
Support / Help with setUniform
« on: January 09, 2013, 03:03:36 pm »
Hi!

I'm trying to make a fragment shader that displaces 2 textures (normal maps) on one of its coordinates using a uniform timer. I have a small static class that manages this with an update method called on each frame that increases the timer. The shader is linked to an object3D and works well except that the textures don't get displaced, as if the uniform timer didn't get updated.

This is a simplified version of what my java class does to the shader:

Code: [Select]
public class myShaderManager{
public static int timer=0;
static GLSLShader myShader;

    public static void update()
    {
        timer=timer+1;
        myShader.setUniform("timer", (float)timer);
    }
}

Am I doing the set uniform part wrong?. For some reason I'm using the exact same shader on another project (openGLES2 only, shaders only differ in naming) and it works well so i'm getting a bit confused and just decided to ask here as I've learned a lot of things in these forums  :)  I can also provide some shader code if needed.


Pages: [1]