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

Pages: [1]
HI :)
If I want to improve the performance of my application on tegra devices, I have read that I should use  NVDepthConfigChooser(GLSurfaceView view).
But if I now use also AAConfigChooser, can I use both ?

I have done in this way :

Code: [Select]
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.threed.jpct.util.AAConfigChooser;
import com.threed.jpct.util.NVDepthConfigChooser;

public class MyGLSurfaceView extends GLSurfaceView {

MyGLRenderer renderer;
Context activitycontext;
public MovementHandler gestore= new MovementHandler();
public boolean rendercontinuo=false;  //se true renderizza in continuazione, se false renderizza su richiesta

public MyGLSurfaceView (Context context)
         activitycontext=context; //prendo il context dell'activity
         // Create an OpenGL ES 2.0 context.
        setEGLConfigChooser(new AAConfigChooser(this));
        setEGLConfigChooser(new NVDepthConfigChooser(this));
        // Set the Renderer for drawing on the GLSurfaceView
        renderer = new MyGLRenderer(activitycontext,gestore);

 public MyGLSurfaceView (Context context, AttributeSet attrs)
        super(context, attrs);
        activitycontext=context; //prendo il context dell'activity
        // Create an OpenGL ES 2.0 context.
       setEGLConfigChooser(new AAConfigChooser(this));
       setEGLConfigChooser(new NVDepthConfigChooser(this));
       // Set the Renderer for drawing on the GLSurfaceView
       renderer = new MyGLRenderer(activitycontext,gestore);

Is it the right way ?

Support / position camera for object to fit in screen height
« on: September 24, 2014, 01:47:38 am »
Hi :)

I have an 3d model and I want to set my camera to fit all the object in screen height.

I did in this way .

I have calculated bounding box :
Code: [Select]
protected float[] calcBoundingBox() {
float[] box = null;

for (Animated3D skin : modello) {
float[] skinBB = skin.getMesh().getBoundingBox();

if (box == null) {
box = skinBB;
} else {
// x
box[0] = Math.min(box[0], skinBB[0]);
box[1] = Math.max(box[1], skinBB[1]);
// y
box[2] = Math.min(box[2], skinBB[2]);
box[3] = Math.max(box[3], skinBB[3]);
// z
box[4] = Math.min(box[4], skinBB[4]);
box[5] = Math.max(box[5], skinBB[5]);
return box;

and after :

Code: [Select]
float[] bb = calcBoundingBox();
box_h = (bb[3] - bb[2]); // model height

Camera camera = world.getCamera();
if(width < height)
camera.moveCamera(Camera.CAMERA_MOVEOUT, 70);  //la sposto indietro
camera.lookAt(new SimpleVector(0, -box_h/2, 0));
float fovy=camera.getYFOV();

double cameraDistance = ( box_h / 2 ) / Math.tan( fovy / 2 );


camera.lookAt(new SimpleVector(0, -box_h/2, 0));


With the -100 offset the 3d model correctly fits in both the portrait mode than landscape mode. But I didn't understand why I have to pur the negative offset -100..

Where did I do wrong ?

Support / Myglsurfaceview in xml layout
« on: September 19, 2014, 07:01:28 pm »
I would to inflate myglsurfaceview in a xml layout, but many errors appeared.. :(
Some guys in this forum have done something like this ?

Bones / skeletonDebugger doesn't work
« on: September 10, 2014, 12:05:40 am »
Hi :)
I would like to see skeleton of my human models, for do that in onDrawFrame I have only used "drawWireframe"

Code: [Select]
public void onDrawFrame(GL10 gl)
if (frameBuffer == null)

frameBuffer.clear(back); //ripulisco il frameBuffer e lo setto con il colore di sfondo voluto
world.drawWireframe(frameBuffer, wireFrameColor, 1, true);


And in onSurfaceChanged I have did this  :

Code: [Select]

private AnimatedGroup modello;

public void onSurfaceChanged(GL10 gl, int width, int height) {
// TODO Auto-generated method stub
if (frameBuffer != null) {
frameBuffer = new FrameBuffer(gl, width, height);

if (master == null) { 

world = new World(); 

Resources res = getResources();
try {

modello = BonesIO.loadGroup(res.openRawResource(R.raw.vincent));
catch (Exception e) {
throw new RuntimeException(e);

world.setAmbientLight(127, 127, 127);

Texture texture = new Texture(res.openRawResource(R.raw.vincent_texture));
TextureManager.getInstance().addTexture("vincent", texture);

for (Animated3D a : modello)

float[] bb = renderer.calcBoundingBox();
float box_h = (bb[3] - bb[2]);

Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 70); 
cam.lookAt(new SimpleVector(0, -box_h/2, 0));

new Light(world).setPosition(new SimpleVector(0, -box_h/2, box_h));

currentPose = modello.get(0).getSkeletonPose();
skeletonDebugger = new SkeletonDebugger(currentPose);


if (master == null) {
Logger.log("Saving master Activity!");
master = MainActivity.this;


int num=modello.get(0).getSkeleton().getNumberOfJoints();
int dim=modello.getSize();
Logger.log("numbers of joints ="+num+",size="+dim);


But the skeleton doesn't appear. 
The log the result is
"numbers of joints=67,size=1"

To this message I have attached the skeleton xml

Support / Simple Camera Movement example
« on: September 07, 2014, 12:42:06 pm »
Hi :)
In this example :

I don't understand this passage very well :

Code: [Select]
if (touchTurn != 0) {
SimpleVector backVect = cube.getTransformedCenter();
touchTurn = 0;

0- I create a matrix rotationmatrix = new matrix();
1- I create a vector to centerposition of my model
2- I multiply this vector for -1 , why ?
3- I apply the traslation created to my rotationmatrix 
4- I rotate it around the Y axis
5- I traslate my matrix to center of my model, why ?

Code: [Select]
if (touchTurnUp != 0) {
transformMatrix.translate(new SimpleVector(0, -touchTurnUp * 30,0));
touchTurnUp = 0;

transformMatrix is a mistake, right ? I have to traslated the rotationmatrix, right ? But why I have to do that ? The rotation round the Y axis is not enough ?

and at last :
Code: [Select]



I don't understand why I have to do setidentity .

Thanks :)

Support / Development suggestions ?
« on: September 05, 2014, 04:17:27 pm »
Hi :)
I'm new in jpct and in 3d programmation.

Have you some suggestions to give me ?

For example, on official google opengl it divide in 3 different files :

and mainactivity

then it extends GLSurfaceView in something like this :
public class MyGLSurfaceView extends GLSurfaceView

I tryed to do in this way but some more doubts has appeared to me  :-\

Can I define world in renderer class ?
How can I access to res from the class that not extend activity ?

Put this code in onSurfaceCreated is equal to put it in oncreate() ?

Code: [Select]
Resources res = getResources();
modello = BonesIO.loadGroup(res.openRawResource(R.raw.vincent));

Do you suggest me the correct approach ?

Support / keepPixelData ?
« on: September 04, 2014, 08:00:32 pm »
Hi :)
I'm newbie in 3d programmation and I never used opengl.
I started from the simple helloworld example and after I have downloaded Ninja Bones .
(because I would animate a rigged model)
There are some functions that I don't know what they do, one of them is keepPixelData().


public void keepPixelData(boolean keepData)
Should a texture's pixels be kept even when the texture has been uploaded to the GPU? Default is false.
keepData - should they?

But what it's meaning ? I don't understand :(

Support / GLSurfaceView.Renderer running in a separate thread ?
« on: August 28, 2014, 01:22:35 pm »
Hi :)
I'm new in Jpct-ae and OpenGL's programmation.
I read some ufficial's material on OpenGL, but I have a doubt.
GLSurfaceView.Renderer it's running in separate thread automatically generated ? Therefore the rendering is executed in a different thread of UI Thread ?
I read this :

And I suppose that the answer of my question is "Yes" , but I'm newbie and I prefer to ask to the experts :)

I will have problems to implement my animation in a fragments using GLSurfaceView ?

Thanks to everyone :)

Bones / I'm trying to find a compatible rigged model
« on: August 20, 2014, 06:37:49 pm »
Hi :)
I'm searching in the web to find a rigged model compatible with bones.

I found some .blend rigged models but when I try to export in ogre format there are many warnings.
For example when I trying to export this model the warning that appear is :
"mesh has 59 vertices weigted to too many bones (ogre limits a vertex to 4 bones)" 

I ignored it but when I use the script to convert in .bones and replace in LoadBonesFormatSample with my the function takes does this error :
Code: [Select]
Exception in thread "main" .\samples\data\ninja\ (Impossibile trovare il file specificato)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)
at bones.samples.LoadBonesFormatSample.loadNinja(
at bones.samples.LoadBonesFormatSample.createAnimatedGroup(
at bones.samples.AbstractSkinSample.initialize(
at bones.samples.LoadBonesFormatSample.initialize(
at bones.samples.AbstractSample.loop(
at bones.samples.LoadBonesFormatSample.main(

I don't know where I mistake but I only want to find one rigged model :(

p.s : I open new topic because in the other thread I'm going off-topic :)

edit : I just installed 3dmax 2015 , perphaphs can I import model with blender or 3d max ;) For export from 3dmax what I have to use ? :)

Bones / Animate rigged model according to given commands
« on: June 05, 2014, 10:14:22 pm »
Hello to everyone :)
I'm trying to animate a human's rigged model for an Android Application ( Real-time Motion Capture ).
Is possible to do this using jPCT-AE and Bones ?
Something like this

I have the library that gives me the position of the sensor in a quaternion.
I thought to set the quaternion on the relative bones.
But I don't know which function I have to use to identify bones and joints of my rigged model and which function I have to use to set its position in quaternion format.

Have you any suggestion for me ? 

Thanks all :)

Pages: [1]