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

Pages: 1 ... 12 13 [14] 15 16
196
Support / Re: Basic text
« on: October 09, 2011, 08:33:50 am »
Yes have a look at the glFont class. It's used in some of the examples including Alien Runner: http://www.jpct.net/download.html

197
Support / Re: object pivot
« on: October 09, 2011, 08:01:49 am »
@stownshend,

One option is to align each object to the center yourself using rotateMesh().

Code: [Select]
player.translate(10, 12, -2);
player.rotateMesh();
world.addObject(player);

198
Support / Re: checkForCollisionEllipsoid() framerate drop
« on: October 09, 2011, 07:32:04 am »
@Thomas, I am using my own code to set objects invisible (using Object3D.SetVisibility) if they are not in the camera's bounding box. Plus I am recycling objects so they respawn in front of the camera when they are not visible.

@Egon, I have about 32 objects set to _OTHERS, but only about 16 are within the immediate area at any time. And those objects are quite far away most of the time, with only 1 or 2 objects very close to the camera/player (say 50 translation units). I could have 16 objects 1000 translation units away, but the ellipsoid function still processes them.

It makes no difference if the objects are visible in the camera frame or behind the camera.

I removed the skydome and removed various objects to check if an object has strange geometry or something, but it made no difference. The frames drop further when there are more objects nearby.

I think there might be a bounding box glitch in the checkForCollisionEllipsoid function because the Sphere function is not dropping frames much at all.
I tested each one at the same location in a frozen state:

45FPS = No collision
41FPS = Sphere collision
31FPS = Ellipsoid collision (1 recursion)
31FPS = Ellipsoid collision (5 recursion)
31FPS = Ellipsoid collision (50 recursion)

Does the Ellipsoid function use the same bounding box filtering as the Sphere function?


Edit: Here's the collision calling section:

Code: [Select]
SimpleVector vcoll = new SimpleVector();
if(nDebug == 0) vcoll = newpos;
if(nDebug == 1) vcoll = player.checkForCollisionSpherical(newpos, 2f);
if(nDebug == 2) vcoll = player.checkForCollisionEllipsoid(newpos, new SimpleVector(2f,2f,2f), 1);
if(nDebug == 3) vcoll = player.checkForCollisionEllipsoid(newpos, new SimpleVector(2f,2f,2f), 5);
if(nDebug == 4) vcoll = player.checkForCollisionEllipsoid(newpos, new SimpleVector(2f,2f,2f), 50);


199
Support / checkForCollisionEllipsoid() framerate drop
« on: October 08, 2011, 05:34:35 pm »
Basically I'm trying to increase the frame rate as much as possible.

I'm using checkForCollisionEllipsoid to collision check the main character but it's dropping the frame rate down from 60FPS+ to about 30-35 FPS, even when using the lowest recursionDepth of 1.

The checkForCollisionEllipsoid frame rate drops even when there are no COLLISION_CHECK_OTHERS objects nearby (they are visible though), does checkForCollisionEllipsoid do any object/mesh distance filtering before calculating using ellipsoid collision?
Perhaps the function could be modified to do a translation/boundingbox distance check before focusing on the ellipsoid precision.
The function seems to be based on the visibility of objects since the framerate dropped as soon as the objects were visible.

I tried using three checkForCollisionSpherical() checks which helped considerably, the frame rate was around 45-50FPS. However I would like to improve the FPS a bit more if possible


Perhaps a new checkForCollisionDualBox() function can be introduced that does dual-box calculations?
i.e. the function would parse two boxes, one large/main box to cover the main body, and another smaller box to cover the head and feet.
checkForCollisionDualBox(SimpleVector translation, SimpleVector box1size, SimpleVector box2size)

200
Support / Re: Object3D.setBillboarding()
« on: October 08, 2011, 08:37:27 am »
ok I'll look into it, thanks.

201
Support / Object3D.setBillboarding()
« on: October 07, 2011, 04:09:22 am »
Question 1: How can I scale billboarded objects? setScale() appears to do nothing.

Question 2: How can I disable billboarding lighting? setLighting(LIGHTING_NO_LIGHTS) doesn't ignore nearby lighting.


Code: [Select]
obj = Primitives.getPlane(2, 2);
obj.setTexture("bb");
obj.setTransparency(50);
obj.setLighting(Object3D.LIGHTING_NO_LIGHTS); //?
obj.setBillboarding(true);
obj.setScale(0.02f); //?
world.addObject(obj);


202
Support / Re: Flickering when using world.removeObject ?
« on: October 05, 2011, 02:33:22 am »
Try to add and remove objects in the main rendering thread (within onDrawFrame) rather than a different thread such as onTouch events/listeners.
If you remove objects at the same time jPCT is rendering the scene, you can cause null pointer exceptions and other problems.

203
Support / Re: Understanding Translations
« on: October 04, 2011, 12:55:49 pm »
Your code will position each object individually in world space. object2's initial position will not be impacted by the translation of object1.

Translate basically moves the object in the world. The translation is not reset at every frame, so each translation is based on the previous translation point.

So if you want to move forward the object in world space at every frame, you would call translate(0f, 0f, 0.1f);

If you want to keep track of the position of the object yourself in world space at every frame, you could do this:

Code: [Select]
onFrame()
{
    // move my object forward incrementally
    myPosZ += 0.1f;

    // Reset the object's position back to it's origin (0,0,0)
    object1.clearTranslation();

    // Set position of object
    object1.translate(myPosX,myPosY,myPosZ);
}

In my opinion, it's easier to keep tabs on the location of the object by simply retrieving it's translation using Object1.getTranslation()

204
Support / Re: Overlay depth
« on: September 30, 2011, 06:53:33 pm »
Try setting the depth of the overlay to something like -100 when calling Overlay.setDepth().

However if you are changing the World render depth using World.setClippingPlanes(), the overlay depth seems inconsistent, causing overlays to render behind 3D objects. Not sure if it's a bug or not, perhaps Egon can provide some insight.

205
Support / Re: Scaling objects dynamically
« on: September 30, 2011, 10:08:49 am »
rotateMesh() did the trick, thanks.

206
Support / Re: Scaling objects dynamically
« on: September 29, 2011, 01:53:57 pm »
I use Object3D.setScale() to rescale an object, but the mesh is not scaled with the object.

I realize that I can delete the object and reload it with the new scale value, but I would like to avoid that.

What function do I call to recreate the mesh on the fly based on the new scale?
(It doesn't matter if the function takes a second or two)

207
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 29, 2011, 11:53:04 am »
I can't seem to find a way to do it, at least efficiently.

GLSurfaceView has a getHolder() function that retrieves the SurfaceHolder.

Perhaps MediaPlayer can render to the OpenGL surface directly?

I tried using mGLView.getHolder() but it crashes. I have yet to check the exception error string but it appears that you need to use callback functions since the GL object runs in a different thread.

208
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: September 28, 2011, 08:45:35 am »
Is there a way to play video to a Texture using the Android MediaPlayer API?

Code: [Select]
// Load video
MediaPlayer mediaPlayer = MediaPlayer.create(m_context, R.raw.videofile);

// Somehow attach the output to a texture
SurfaceHolder sh = ??? (Texture Surface)
mediaPlayerVid.setDisplay(sh);

// Play video
mediaPlayer.start();


209
Support / Re: How to use 2048 * 1024 texture on a sphere?
« on: September 23, 2011, 06:48:12 pm »
hehe yeah I think we will see a big jump in memory capacity and performance soon.

The Tegra Wiki suggests that performance will be 10x faster with the Tegra 4 chip next year (compared to Tegra2), then 50x faster the following year, including support for OpenGL 4.0
http://en.wikipedia.org/wiki/Nvidia_Tegra#Tegra_3_.28Kal-El.29_series

210
Support / Re: Inconsistency in collision detection
« on: September 23, 2011, 06:09:54 pm »
I see, ok I may just stay with magic numbers if that's the normal way of doing it.

Pages: 1 ... 12 13 [14] 15 16