[android-developers] Re: vertice coodinates of Kube

2009-06-17 Thread Nightwolf
Cube coordinates are stored in vertices array in Cube.java. Rotating effect is achieved via model view matrix modification (glTranslate and glRotate commands). Original vertex data isn't modified. On Jun 17, 8:30 pm, quill wrote: > Hi all, > I'm modifying Kube(api demo) to a game, does anyone wh

[android-developers] Re: vertice coodinates of Kube

2009-06-18 Thread quill
Thank you Nightwolf. I want to choose the Kube when I touch on the Kube face in order to rotate Kube. My idea is: 1. to get vertices of Kube to compose a polygon(2D); 2. judge if the touch point locates in the polygon; As you said, the cube coordinates is not modified, so I use gluunproject() to c

[android-developers] Re: vertice coodinates of Kube

2009-06-18 Thread Timothy F
I haven't used it yet, but look at: http://developer.android.com/reference/android/opengl/GLU.html#gluUnProject(float,%20float,%20float,%20float[],%20int,%20float[],%20int,%20int[],%20int,%20float[],%20int) I think that may help you. On Jun 18, 4:21 am, quill wrote: > Thank you Nightwolf. > I

[android-developers] Re: vertice coodinates of Kube

2009-06-18 Thread Streets Of Boston
Yes, you are on the right track. :-) However, i could not get gluUnProject to work. I wrote my own: http://groups.google.com/group/android-developers/browse_frm/thread/9d2bf53e3a798cb6/c722628acdf6e2d9 (see messages no. 6 and 8) On Jun 18, 4:21 am, quill wrote: > Thank you Nightwolf. > I wa

[android-developers] Re: vertice coodinates of Kube

2009-06-18 Thread Nightwolf
It seems that you already know more than me on this subject. May be there is a sense to use simple approach. Treat cube as a circle and test whether touch point is in that circle or not. Of course it's less accurate and you need to define cube center somehow. On Jun 18, 12:21 pm, quill wrote: >

[android-developers] Re: vertice coodinates of Kube

2009-06-18 Thread quill
Hi Boston, I failed with both GLU.gluUnProject or your gluUnProject. Maybe there is something wrong with my polygon coordinates. In fact, the polygon is just a square, which is the face of a small cube. I get the coordinates from GLWord.mVertexBuffer(such as mVertexBuffer.get(0)/ 65536.0), is this

[android-developers] Re: vertice coodinates of Kube

2009-06-19 Thread Streets Of Boston
The gluUnProject should just be used to translate the coordinates of your finger on the screen (x1,y1,z1), where z1 is 0...1, to a 3d coordinate in your Kube space (x2,y2,z2). You calculate it for z1=0 and z1=1, which gives you two coordinates in Kube space, a line: unproject(x1,y1,0) --> (Sx2,Sy