Main Menu
Menu

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.

Show posts Menu

Messages - Uncle Ray

#1
method A
{
obj.cleartranslation();
obj.translate(10,10,10);
}

method B
{
obj.cleartranslation();
obj.setorigin(10,10,10);
}


In my project,method A and method B are different obj's location,
Any tips?
#2
problem still.ego,how do you make the collide ellipsoid viaible?
maybe my code was wrong?
i just need to see the collide ellipsoid.
any tips?
#3
I just need create a Ellipsoid,which is the same width,height,lengh and position with checkforcollitionEllipsoid's Ellipsoid.

Any helps will be much appreciated.
#4
SimpleVector Ellipsoid=new SimpleVector(0,0,0)
SimpleVector boundingEllipsoid =new SimpleVector(0,0,0)
Object3D boundingbox;
Object3D target;
float scale=2;
ini()
{
                 target=...............;
                 target.setscale(scale);
                float[] box = target.getMesh().getBoundingBox();
      float widthX = box[1] - box[0];
      float heightY = box[3] - box[2];
      float lengthZ = box[5] - box[4];
      ellipsoid.x = widthX/2+1 ;
      ellipsoid.y = heightY/2+1 ;
      ellipsoid.z = lengthZ/2+1 ;
               boundingEllipsoid.x=ellipsoid.x*2/scale;
               boundingEllipsoid.y=ellipsoid.y*2/scale;
               boundingEllipsoid.z=ellipsoid.z*2/scale;
boundingbox= ExtendedPrimitives.createEllipsoid(boundingEllipsoid, 20);
    world.addObject(boundingbox);
    boundingbox.addParent(target);   
    boundingbox.clearTranslation();
    boundingbox.setOrigin(target.getTransformedCenter());
   
}

update()
{
    fix_front=obj.checkForCollisionEllipsoid(front, Ellipsoid,5);
    if(front.equals(fix_front)==true)
    {
      obj.setTransparency(-1);
    }
    if(front.equals(fix_front)==false)
    {
       obj.setTransparency(0);
    }


}





MY PROBLEM:
i want Ellipsoid visible,so i create boundingbox to show the checkEllipsoid's Ellipsoid.but i my program,some times the checkcollideEllipsoid work,and some times checkcollideEllipsoid unwork.

so,i think may be my boundingbox is wrong,so how to create the right boudingbox,the same scale and the same position with checkcollideEllipsoid's Ellipsoid?
#5
Object3D source;
Object3D target;
SimpleVector ellipsoid=new SimpleVector(10,10,10);
ini()
{
source.setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS);
target.setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS);
source.build();
target.build();
}

update()
{   
    simpleVector front=obj.getZAxis();
     simpleVector fix_front=null;
    fix_front=obj.checkForCollisionEllipsoid(front,ellipsoid, 5);
    if(front.equals(fix_front)==true)
    {
       source.setTransparency(-1);//source will see
    }
    else if(front.equals(fix_front)==false)
    {
       source.setTransparency(0);//source will disappear
    }
   source.translat(fix_front);
}







my problem:
when ellipsoid=(10,10,10) or ellipsoid=(100,100,100);
their checkcollition's distance was the same,just same unit away between source and target,then source be disappear.

so how to change checkcollition's distance?whatever i do with ellipsoid,but the distance just the same.

#6
yes,yes,the very key is the GLSurfaceView.setPreserveEGLContextOnPause(true);it solved my problem perfectly.
Giant appreciation to you ego,Nothing i can see,without thx.
#7
in onPause,i did nothing just super method

protected void onPause()
{
      
      super.onPause();
      mGLView.onPause();//GLSurfaceView mGLView
      
}
#8
because,if i without  touch home button,like "Unloaded texture: <int>",will display.

but,if i touch home button and return my app,like "Unloaded texture: <int>".was disappear.

yes,your are right,may the old context is destroyed,but their memory never freed,after i return to app,the freememoy just freeed the new context's memory,the old context's memory will never free,although the old context was destroyed.


i have soled,in this way,meybe there is better solution?can you tell me?
public void onSurfaceChanged(GL10 gl, int width, int height)
{       
  fb.freememory;//unload old context's  framebuffer memory
   
  fb=null;
  fb=new frameeBuffer(width,height);
  ini_tex(fb);//initialize new context's framebuffer
  Config.unloadImmediately=true;                   
  texturemanage.removeAndUnload("a", fb);       
  texturemanage.removeAndUnload("c", fb);
   ................................................
  fb.freememory;
}


#9
Support / FrameBuffer.freememory sometimes useless?
April 27, 2015, 11:04:34 AM
Solved by ego
Answer:GLSurfaceView.setPreserveEGLContextOnPause(true);

_______________________________________________________
without touch phone's home button,freememory method it was good.
it free memory immediately,very nice.
but if i touch phone's home button and return to my app again.
the freememory method was never work,and the memory was never free.


may be my bug was in onSurfaceChanged?

here is my code:

public void onSurfaceChanged(GL10 gl, int width, int height)
{       
  fb=null;
  fb=new frameeBuffer(width,height);
  Config.unloadImmediately=true;                   
  texturemanage.removeAndUnload("a", fb);      
  texturemanage.removeAndUnload("c", fb);
   ................................................
  fb.freememory;
}


#10
with DDMS,set object3d to null,later memory will be freed.
but world.removeobject(obj),memory never freed.


ok,i think set to null,it was the best method to destroy Object3D.
#11
When i use world.removeObject(obj),and later use world.addObject(obj),the obj  is still there.

i thought removeobject() will clear object from memory,in fact i am wrong?

so,if i want to destroy obj,i just use,
obj.clearobject();
obj.clearrotation();
obj.cleartranslation();
obj=null;


is that right?

in a shorting say,if i want destroy a object3D,which method will free memory,and really set the obj clear?
#12
i am sorry,the reason is not ser.

the reason is 3ds max,when 3ds max export to 3ds,md2,ser,the uv would be strange.

it is my fault,not the bug of jpct.

Thank you very much,for your help.

Next time,i would be check it and check it many times
before pose a question,in here.

thank you again,and again.

#13
i have sent it to you with email,please check it.

#14
Thx,i think,i found the reason.
yes,you're right.it is exporter issue.

3ds max with md2,its right.jpct with ser,it's strange.
so i give up to translate md2 to ser.just keep md2.
when i keep the md2,the 3ds max and jpct just look the same.

honestly,it's not the first time appears issue with ser.
somtimes uv issue,sometimes location issue,sometime obj's id issue.

#15
both device and emulator.
i have the model and texture,
would you mind tell me your email address,
i can sent it to you for tested it?

i have tried many decives they just the same.still different with 3ds max.