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 - ndr123

Pages: [1]
1
Support / Re: Problem with OpenGL ES 2.0
« on: December 19, 2011, 09:07:19 pm »
Thanks, it solved.  :)

2
Support / Re: Problem with OpenGL ES 2.0
« on: December 19, 2011, 05:27:30 pm »
This is the logcat output concerning OpenGL
Code: [Select]
12-19 15:46:06.100: I/jPCT-AE(8583): OpenGL vendor:     NVIDIA Corporation
12-19 15:46:06.100: I/jPCT-AE(8583): OpenGL renderer:   NVIDIA Tegra
12-19 15:46:06.100: I/jPCT-AE(8583): OpenGL version:    OpenGL ES 2.0
12-19 17:24:29.340: I/jPCT-AE(21407): OpenGL renderer initialized (using 0 texture stages)
To initialize OpenGL ES 2.0 I followed the example provided in the package and so I'm initiliazing it calling this function
Code: [Select]
// Enable the OpenGL ES2.0 context
setEGLContextClientVersion(2);

3
Support / Problem with OpenGL ES 2.0
« on: December 19, 2011, 04:27:14 pm »
Hi, I'm having a problem with OpenGL ES 2.0 on jPCT-AE. Since I used OpenGL ES 1.1 everything worked fine but since I changed to OpenGL ES 2.0 I'm getting an error where I try to draw. This is logcat output:
Code: [Select]
12-19 15:46:06.410: E/AndroidRuntime(8583): java.lang.ArrayIndexOutOfBoundsException: index=0 length=0
12-19 15:46:06.410: E/AndroidRuntime(8583): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:1163)
12-19 15:46:06.410: E/AndroidRuntime(8583): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:151)
12-19 15:46:06.410: E/AndroidRuntime(8583): at com.threed.jpct.World.compile(World.java:2055)
12-19 15:46:06.410: E/AndroidRuntime(8583): at com.threed.jpct.World.renderScene(World.java:1093)
12-19 15:46:06.410: E/AndroidRuntime(8583): at it.ball.GameViewer$GameRenderer.onDrawFrame(GameViewer.java:1201)
12-19 15:46:06.410: E/AndroidRuntime(8583): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1429)
12-19 15:46:06.410: E/AndroidRuntime(8583): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1184)
I also have in output on logcat
Code: [Select]
12-19 15:46:06.390: E/libEGL(8583): called unimplemented OpenGL ES API
Currently I'm testing on an Eee pad transformer with NVIDIA Tegra 2.

4
Support / Re: Lights
« on: December 01, 2011, 11:04:10 am »
Yes, merging them into a single object helps. The result is still not so good but it is due to the very few triagle used in making the walls (I can see more or less the triangles on the walls). Can you suggest me an easy way to build walls with more triangles?

5
Support / Re: Lights
« on: November 30, 2011, 02:15:13 pm »
I have a room created through
Code: [Select]
walls = new Object3D[6];

//create and set back wall
walls[0] = new Object3D(2);
walls[0].addTriangle(new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
walls[0].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
walls[0].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
//walls[0].setAdditionalColor(wall);
walls[0].calcTextureWrap();
walls[0].setTexture(wall_text);
walls[0].strip();
walls[0].build();

//create and set bottom wall
walls[1] = new Object3D(2);
walls[1].addTriangle(new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
walls[1].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0));
//walls[1].setAdditionalColor(wall);
walls[1].calcTextureWrap();
walls[1].setTexture(wall_text);
walls[1].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls[1].strip();
walls[1].build();

//create and set top wall
walls[2] = new Object3D(2);
walls[2].addTriangle(new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0));
walls[2].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
//walls[2].setAdditionalColor(wall);
walls[2].calcTextureWrap();
walls[2].setTexture(wall_text);
walls[2].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls[2].strip();
walls[2].build();

//create and set right wall
walls[3] = new Object3D(2);
walls[3].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0));
walls[3].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
//walls[3].setAdditionalColor(wall);
walls[3].calcTextureWrap();
walls[3].setTexture(wall_text);
walls[3].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls[3].strip();
walls[3].build();

//create and set left wall
walls[4] = new Object3D(2);
walls[4].addTriangle(new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
walls[4].addTriangle(new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, CARTESIAN_DEPTH));
//walls[4].setAdditionalColor(wall);
walls[4].calcTextureWrap();
walls[4].setTexture(wall_text);
walls[4].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls[4].strip();
walls[4].build();

//create and set front wall
walls[5] = new Object3D(2);
walls[5].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0));
walls[5].addTriangle(new SimpleVector(HALF_CARTESIAN_WIDTH, HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(-HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0), new SimpleVector(HALF_CARTESIAN_WIDTH, -HALF_CARTESIAN_HEIGHT, 0));
walls[5].setTransparency(0);
walls[5].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls[5].strip();
walls[5].build();
where the macros and the variable are declared in this way:
Code: [Select]
private final int CARTESIAN_WIDTH = 63;
private final int CARTESIAN_HEIGHT = 34;
private final int CARTESIAN_DEPTH = 50;
private final float HALF_CARTESIAN_WIDTH = 31.5f;
private final float HALF_CARTESIAN_HEIGHT = 17f;

private Object3D[] walls = null;

My problem is that is, if I put a light in (0,0,-150) top and bottom wall does not get lighted. So I worked around this by placing 2 lights which are respectively in (0,-50,-200) and in (0,50,-200). With the two lights placed that way, all the walls get lighted. My problem is that I needed to place a new light inside the room (for example, in (12, 5, 29)), but once again the back and top wall does not get lighted by that light. I searched in che Config class to see if the was some variable I could modify to try to make it work but the only one I found is Config.maxLights and I tried increasing it (currently it is set to 24 in my application) but the problem is still there

6
Support / Lights
« on: November 29, 2011, 06:54:09 pm »
Hi, I wanted to ask if the lights created through
Code: [Select]
new Light(world) are omnidirectional lights. Cause if they are I'm having a problem.

7
Support / Re: Collision detection problem
« on: November 19, 2011, 12:01:33 pm »
While doing other test with my application, the checkforcollisoinspherical suddenly started working. I don't know what can be the matter cause I didn't change anything in the way I check for collisions nor in the way collisions flags on the objects are set. Anyway, as the checkforcollisionspherical needs a much higher value of collideoffset respect to the checkforcollisionellipsoid (with checkforcollisionspherical I need a collideoffset of 100 while with checkforcollisionellipsoid a value of 5 is enought to make everything work fine), using the latter results in higher framerate so I'm using the second. Thanks for the help :)

8
Support / Re: Collision detection problem
« on: November 11, 2011, 12:31:14 am »
Yes usually I have it set to 5 but I changed it to more than 100 during my tests (I don't remember the exact number)

9
Support / Re: Collision detection problem
« on: November 10, 2011, 07:58:41 pm »
No the collision mode is correct as spheres should not collide with all the others. At this first stage, they should collide only with walls to remain inside the screen but they don't and go out of the screen.
To make more clear, I'm deleveloping a game in which you have spheres running around in a 3D room; they not collide with each other but just with walls. Then by touching the screen, you shoot a sphere and by touching again you make it explode. After the explosion, if a sphere collides with the exploded sphere, it explodes too (when a sphere explodes, it stops moving and grows a little and I change its collision mode from check self to check others) and the goal is to make explode as much spheres as possible.

10
Support / Re: Collision detection problem
« on: November 10, 2011, 03:14:45 pm »
Code: [Select]
v = spheres[i].checkForCollisionSpherical(sphere_velocity[i], 1);
I tried also with other radius (e.g. 5, 10) but collisions weren't detected too.

11
Support / Re: Collision detection problem
« on: November 10, 2011, 01:18:26 am »
I set collision mode correctly as the only thing I change while changing to ellipsoid to spherical is the checkforcollision call. And that's why I can't understand which the problem is.
This is how I create the spheres
Code: [Select]
for(int i = 0; i < NR_SPHERES_LV5; i++){
sphere_velocity[i] = new SimpleVector(Math.random()*MAX_VELOCITY, Math.random()*MAX_VELOCITY,Math.random()*MAX_VELOCITY);
sphere_initial_position[i] = new SimpleVector((Math.random()*(CARTESIAN_WIDTH-3))-((CARTESIAN_WIDTH-3)/2),
(Math.random()*(CARTESIAN_HEIGHT-3))-((CARTESIAN_HEIGHT-3)/2),
(Math.random()*(CARTESIAN_DEPTH-3))+1.5);
sphere_exploded[i] = false;
sphere_explosion_time[i] = 0;
sphere_explosion_scale[i] = 1;
chain_explosion_nr[i] = -1;
spheres[i] = base_sphere.cloneObject();
spheres[i].setTexture(sphere_textures[color_index]);
spheres[i].setCollisionMode(Object3D.COLLISION_CHECK_SELF);
color_index++;
if(color_index == sphere_textures.length)
color_index = 0;
}
and this is how now I check for collisions:
Code: [Select]
v = spheres[i].checkForCollisionEllipsoid(sphere_velocity[i], ellipsoid, 3);sphere_velocity is a vector containing the translation vector of each sphere and ellipsoid = new SimpleVector(1.2, 1.2, 1.2).
When I tried using the checkforcollisionspherical I called it with various radius but with no one I got collision.

12
Support / Re: Collision detection problem
« on: November 09, 2011, 08:54:53 pm »
Maybe it is something related to the fact that I create the spheres through copyObject() from an initial one cause I remember I tried to use the spherical collision when I used to create all the spheres through Primitives.getSphere and it worked at that time.

13
Support / Re: Collision detection problem
« on: November 09, 2011, 01:05:33 am »
No, it is not the problem as the maximum translation is (1,1,1) but usually it is enough smaller (I create the components of the translation vector through Math.random() ).

14
Support / Collision detection problem
« on: November 08, 2011, 06:04:57 pm »
Hi,
I'm having a problem with collision detection. If I use checkforcollisionellipsoid, collisions are detected and everything works fine. The problem is when I try to use checkforcollisiospherical. When I do, collisions aren't detected and so nothing works anymore.
In particular, I have some spheres with radius 1 created by copying them from a sphere created through Primitives.getSphere(12, 1). I tried using checkforcollisionspherical as now I'm calling the checkforcollisionellipsoid with new SimpleVector(1.2, 1.2, 1.2) as ellipsoid and so I though I could save time using the faster checkforcollisionspherical (through what I read, I understood checkforcollisionspherical is faster than checkforcollisionellipsoid).

Pages: [1]