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

Topics - hisong

#1
Support / How to Draw a circle?
February 20, 2012, 07:19:22 AM
Hi,guys.

I want to draw a circle but it seems that none of funtions of Class Primitives supports to make one.

How can I do?   Or can I only make one from a 3DS or a OBJ file?

and another question:  Since I create a Skybox and add texture on it, the skybox work well.but then I want to add a object of Object3D in the Skybox, the object was invisible.



                        skyBox = new SkyBox(10);

world = skyBox.getWorld();
world.setAmbientLight(255, 255, 255);

plane = Primitives.getPlane(10, 2);
plane.strip();
plane.build();
world.addObject(plane );

// 获得相机
cam = world.getCamera();
// 设置相机的位置,在中心的位置
cam.setPosition(plane.getTransformedCenter());

cam.lookAt(new SimpleVector(0, 0, -1));


anyone help me?
#2
Support / How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 08:50:28 AM
I was trying to use larger than 1024x1024 textures on a sphere I get from a 3ds file.

But an error of "Out of Memory" occurs during the the program is beginning to run.

And if I use the BitmapHelper to rescale the image to 1024*1024,  It works well.


Bitmap bitmap = BitmapHelper.rescale(BitmapFactory
.decodeFile("/sdcard/jpct/hd.jpg"), 1024, 1024);
// Bitmap bitmap = BitmapFactory.decodeFile("/sdcard/jpct/hd.jpg");
Texture texture = new Texture(bitmap);
bitmap.recycle();

TextureManager.getInstance().addTexture("texture", texture);


Dose JPCT-AE not support the 2048*1024 or higher??

ps:I can use Opengl ES to load an image of 2048 * 1024 resolution. and of cause it work well and smoothly.

Thanks for help~~
#3
Support / object is null while object picking
August 24, 2011, 03:27:52 PM
Hi, I am again.
I am doing a test about picking with JPCT-AE , so I consulted the threads(http://www.jpct.net/forum2/index.php?topic=1601.0 and http://www.jpct.net/wiki/index.php/Picking) about picking.

I did like the thread discussed, but I always get the null result! I don't know why.

This is the code sample.

I get two objects of Object3D from the 3ds file: cube[0] and cube[1],  I want to pick the cube[1] in the world.
so I set the cube[1] to be picked:


try {
cube = Loader.load3DS(
new FileInputStream("/sdcard/jpct/sphere.3ds"), 1);
Loader.clearCache();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

cube[0].setTexture("texture");
cube[0].strip();
cube[0].build();
world.addObject(cube[0]);

cube[1].setTexture("mark");
cube[1].strip();
cube[1].build();
world.addObject(cube[1]);

cube[1].setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);



and then I was doing picking like this as the thread http://www.jpct.net/wiki/index.php/Picking  did.


SimpleVector dir=Interact2D.reproject2D3DWS(world.getCamera(), fb, (int)AppConfig.screenX, (int)AppConfig.screenY ).normalize();;
Object[] res = world.calcMinDistanceAndObject3D(world.getCamera().getPosition(), dir, 10000 /*or whatever*/);
judgePicking(res[1]);




public void judgePicking(Object object)
{
if(object.equal(cube[1]))
{
Log.i("Path", "Picking");
}
else {
Log.i("Path", "NULL");
}
}


I always get "null" from the function of "judgePicking()". I don't know what goes wrong.
anyone could help me?  Thanks very much.


#4
Support / The texture on sphere appeared not properly
August 09, 2011, 11:59:10 AM
     Hi,I'm a newbie for jpct-ae.  I used the getSphere(float scale) Function of Primitives Class.  and then map a earth on it.   I found that the sphere appeared not properly.  I also use the opengl es of android to draw a sphere and map a texture on it.  It showed correctly.

this is the code sample

Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(context.getResources().getDrawable(R.drawable.earth)),1024,512));
TextureManager.getInstance().addTexture("texture", texture);


// cube = Primitives.getCube(20);
cube = Primitives.getSphere(25, 25);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.build();

world.addObject(cube);
com.threed.jpct.Camera cam = world.getCamera();
cam.moveCamera(com.threed.jpct.Camera.CAMERA_MOVEOUT,50);
cam.lookAt(cube.getTransformedCenter());

I also found that  it is slow when the project is generating the sphere!!

anyone met this problem??  thanks

[attachment deleted by admin]