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]
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)
  {
         super(context);
         activitycontext=context; //prendo il context dell'activity
         // Create an OpenGL ES 2.0 context.
        setEGLContextClientVersion(2);
        setEGLConfigChooser(new AAConfigChooser(this));
        setEGLConfigChooser(new NVDepthConfigChooser(this));
        // Set the Renderer for drawing on the GLSurfaceView
        renderer = new MyGLRenderer(activitycontext,gestore);
        setRenderer(renderer);
       
        if(rendercontinuo==false)
        setRenderMode(RENDERMODE_WHEN_DIRTY);
       
    }

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

Is it the right way ?

2
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.setPosition(0,-box_h/2,0);
camera.moveCamera(Camera.CAMERA_MOVEOUT, 70);  //la sposto indietro
camera.lookAt(new SimpleVector(0, -box_h/2, 0));
}
else
{
float fovy=camera.getYFOV();


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


camera.setPosition(0,-box_h/2,(float)cameraDistance-100);


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 ?

3
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 ?

4
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]
@Override
public void onDrawFrame(GL10 gl)
{
if (frameBuffer == null)
return;

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

}

And in onSurfaceChanged I have did this  :

Code: [Select]

private AnimatedGroup modello;

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
// TODO Auto-generated method stub
Logger.log("onSurfaceChanged");
if (frameBuffer != null) {
frameBuffer.dispose();
}
frameBuffer = new FrameBuffer(gl, width, height);

if (master == null) { 


world = new World(); 


Resources res = getResources();
try {

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

world.setAmbientLight(127, 127, 127);
world.buildAllObjects();

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

for (Animated3D a : modello)
{
a.setTexture("vincent");
a.discardMeshData();
}



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

Camera cam = world.getCamera();
cam.setPosition(0,-box_h/2,0);
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);
skeletonDebugger.setVisibility(true);
skeletonDebugger.addToWorld(world);


MemoryHelper.compact();


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

5
Support / Simple Camera Movement example
« on: September 07, 2014, 12:42:06 pm »
Hi :)
In this example :
http://www.jpct.net/wiki/index.php/Simple_Camera_Movement

I don't understand this passage very well :

Code: [Select]
if (touchTurn != 0) {
SimpleVector backVect = cube.getTransformedCenter();
backVect.scalarMul(-1.0f);
rotationmatrix.translate(backVect);
rotationmatrix.rotateY(touchTurn);
rotationmatrix.translate(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]
transformMatrix.setIdentity();

fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();


}

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


Thanks :)

6
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 :

GLSurfaceView.Renderer
GLSurfaceView
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));
modello.addToWorld(world);

Do you suggest me the correct approach ?

7
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().

Quote
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.
Parameters:
keepData - should they?

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

8
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 : http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html

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 :)

9
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 http://www.turbosquid.com/FullPreview/Index.cfm/ID/535459 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 ninja.group.bones in LoadBonesFormatSample with my xxx.group.bones the function takes does this error :
Code: [Select]
Exception in thread "main" java.io.FileNotFoundException: .\samples\data\ninja\stacy.group.bones (Impossibile trovare il file specificato)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at bones.samples.LoadBonesFormatSample.loadNinja(LoadBonesFormatSample.java:46)
at bones.samples.LoadBonesFormatSample.createAnimatedGroup(LoadBonesFormatSample.java:42)
at bones.samples.AbstractSkinSample.initialize(AbstractSkinSample.java:79)
at bones.samples.LoadBonesFormatSample.initialize(LoadBonesFormatSample.java:85)
at bones.samples.AbstractSample.loop(AbstractSample.java:91)
at bones.samples.LoadBonesFormatSample.main(LoadBonesFormatSample.java:97)

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 ? :)

10
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 https://www.youtube.com/watch?v=NYT-nx533nM

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]