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

#1
Support / Re: How to Draw a circle?
February 20, 2012, 03:49:06 PM
Thanks a lot. I will try it.
#2
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?
#3
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 04:12:38 PM
I think that the problem  may be caused by the 3ds file(the segment or the radius are too large for I had set the segment of 32 and the radius of 20).

I will test it tomorrow.

Good night.
#4
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 03:26:07 PM
Quote from: K24A3 on September 21, 2011, 02:58:24 PM
What android device/phone are you using? (please don't say the Android Emulator :p)

Have a read of this article: http://blog.javia.org/how-to-work-around-androids-24-mb-memory-limit/

I don't know how accurate that article is, but it mentions that you can get around the 24MB memory limit by using OpenGL textures, apparently textures are not limited to 24MB.

Also, what is your android:minSdkVersion value in the AndroidManifest.xml file? Increasing it to say "9" (gingerbread) may help relieve limitations.

Oh, My device is the Defy of Motorala.  Dose it not support the 24MB Memory limitation?

I got the value of 3502168 from the android.os.Debug.getNativeHeapAllocatedSize().

And I work with the eighth minSDKVersion.
#5
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 02:51:47 PM
Hehe,   I haven't gotten  crazy yet.  Thanks for your suggestions.

I was just confused why I could load the image with opengl es, but not with jpct-ae.
#6
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 02:02:24 PM
Quote from: K24A3 on September 21, 2011, 11:22:05 AM
Each type/model of Graphics Chip (GPU) has it's own maximum texture size, so you should check the size before creating large textures.

To query the texture size, call glGetIntegerv() in your main Activity's GLSurfaceView.Renderer class. You need a pointer to GL10 so you could place it in onSurfaceCreated().


public void onSurfaceCreated(GL10 gl, EGLConfig config) {
// Do nothing special.
int[] maxTextureSize = new int[1];
gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);
Log.v("Log", "Max texture size = " + maxTextureSize[0]);

}




I got a value 4096 from the maxTextureSize.  Dose it mean I can handle the texture with as larger as 4096*4096?
But now I can't load a texture with 2048*1024....
#7
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 10:20:16 AM
and what does the JPCT-AE base on ? 

If it is base on Opengl ES 1.0 or 1.1, I think it would  support  2048*1024 resolution file for I doing a test with Opengl ES1.0.
#8
Support / Re: How to use 2048 * 1024 texture on a sphere?
September 21, 2011, 10:05:22 AM
Thanks for replying so quickly. :)

I use such a large image so I can view  in a  360 degree panoramic scene more  clearly. 

And the image has a size of 200KB, I am confused that why it costs  8MB of memory? 

what I can do if I want to use such a big file with JPCT-AE instead of compressing the resolution?
#9
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~~
#10
Support / Re: object is null while object picking
August 24, 2011, 07:18:53 PM
Thomas.  I think I found what causes the question:  It may be I don't subtract the offset of the title when I was using the screen coordinate.

It helps me a lot with the thread:http://www.jpct.net/forum2/index.php/topic,2191.msg16277.html#msg16277
I suggest that the doc would be better if the doc could be more detailed.

Thanks all who viewed this post.

Hisong
#11
Support / Re: object is null while object picking
August 24, 2011, 06:12:07 PM
Quote from: Thomas. on August 24, 2011, 05:45:03 PM
and what you have in AppConfig.screenX?

The AppConfig class stores the values of the screen coordinate I got from the onTouchEvent(MotionEvent e).

The screenX and screenY are the static variables of AppConfig Class.
#12
Support / Re: object is null while object picking
August 24, 2011, 05:16:03 PM
Quote from: Thomas. on August 24, 2011, 03:36:08 PM
you compare Object and Object3D...
...
judgePicking((Object3D)res[1]);
...
public void judgePicking(Object3D object){...}

Thank you for replying so quickly.
I did what you said above. It didn't work.
What's more I think it does needn't to do this because the Object3D is the subclass of Object.
the parameter Object of judgePicking(Object3D object) will do explicit casts.
#13
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.


#14
Quote from: EgonOlsen on August 10, 2011, 07:14:39 AM
Remove that line. You shouldn't create texture coordinates on objects that already have some: cube.calcTextureWrapSpherical();

Thank you very much. I had got it for I remove the code line that you suggest.

But I also found the other issue: The first time I had build the app, the app work.  And then I restart the app or rebuild the app, it calls an error.
I checked the error:ERROR/AndroidRuntime(13590): java.lang.RuntimeException: [ 1312968646623 ] - ERROR: A texture with the name 'texture' has been declared twice!

The error made me confuse. How to solved it ??
#15
Quote from: EgonOlsen on August 09, 2011, 03:05:05 PM
Objects genearted by Primitives have no proper uv-mapping. If you want that, you have to load a "real" model. For a sphere, you might want to try this one: http://www.jpct.net/download/misc/terra.asc

Thank you for replying so quickly.

You mean that the ASC file carry the "u v" information??
I use the Loader to load the ASC file you give. but the texture remain appear not properly.
This is the code sample I had modify.

try {
cube = Loader.loadASC(new FileInputStream("/sdcard/terra.asc"), 4, true);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
cube.calcTextureWrapSpherical();
cube.strip();
cube.build();