How to get the matrix?

168 views
Skip to first unread message

Minsung

unread,
Aug 8, 2010, 4:05:27 AM8/8/10
to AndAR Android Augmented Reality
Hi,

I'm struggling with getting the matrix of gl.
I want to know the transformation matrix of GL when the object is
drawn,
so i put the command in the draw(GL10 gl) method of CustomObject.

gl.glGetIntegerv(GL10.GL_PROJECTION,mat,0);

which gives me the null matrix.

gl.glGetIntegerv(GL10.GL_MODELVIEW,mat,0);

also gives me the null matrix.

Therefore, I tried to find other way to get it, and I used
MatrixGrabber(http://developer.android.com/resources/samples/ApiDemos/
src/com/example/android/apis/graphics/spritetext/MatrixGrabber.html)

However, now it gives me an identity matrix.

I have no idea how I can get the matrix at all :(
Could you help me,plz?

tdo...@googlemail.com

unread,
Aug 8, 2010, 5:21:47 PM8/8/10
to AndAR Android Augmented Reality
Hi
you can access the ARToolkit's transformation matrix through the
getTransMatrix() method of the arobjet.
More on the coordinate systems of ARToolkit:
http://www.hitl.washington.edu/artoolkit/documentation/cs.htm

Regards
Tobi

Minsung

unread,
Aug 11, 2010, 4:56:33 AM8/11/10
to AndAR Android Augmented Reality
Thanks a lot :)

On 8월9일, 오전6시21분, "tdom...@googlemail.com" <tdom...@googlemail.com>
wrote:
> > Could you help me,plz?- 원본 텍스트 숨기기 -
>
> - 원본 텍스트 보기 -

tdo...@googlemail.com

unread,
Aug 11, 2010, 4:47:52 PM8/11/10
to AndAR Android Augmented Reality
your welcome. could you resolve your issues?
I'm myself playing around with the transformation matrix, during the
development of AndAR Pong: http://twitpic.com/2ds8eh
For this game I had to determine the relative position of one marker
to another. I added some matrix methods to the ARToolkit class, in
order to do so.(the code is in the repository if anyone is interested)

Regards
Tobi

Minsung

unread,
Aug 16, 2010, 4:44:09 AM8/16/10
to AndAR Android Augmented Reality
Well,
i got the matrix easily,
but its for from model's 3 coordinate system to camera's 3coordinate
system.
And now im looking for 3 coordinate system to screen's 2coordinate
system.
And i will take a look at your PONG.
Thanks

On 8월12일, 오전5시47분, "tdom...@googlemail.com" <tdom...@googlemail.com>
wrote:

tdo...@googlemail.com

unread,
Aug 16, 2010, 4:21:35 PM8/16/10
to AndAR Android Augmented Reality
Hi,
it's the object's coordinates in the camera's coordinate system, in
order to get the opposite do the following:
ARToolkit.arUtilMatInv(inMatrix, outMatrix)

outMatrix will now hold the camera's coordinates in the object's
coordinate system.

what do you mean by screen's 2coordinate system?

Regards
Tobi

Minsung

unread,
Aug 17, 2010, 2:22:10 AM8/17/10
to AndAR Android Augmented Reality
Hi Tobi

the 3d objects are actually drawn on the screen of 2 coordinate
system.
I'm not sure, but maybe this is what we call projection matrix?? the
matrix converting 3 coordinates to 2 coordinates
As I found, there are two ways of projection, using the commands
"glOrtho" and "glFrustum". "parallel projection" and "perspective
projection"
I thought it's using glOrtho, cuz I found it in the source code.
However, it was for only to 2d objects as it was in the function
'setupDraw2D'.
I looked for glFrustum but it is in ARToolkit, I think.

Here is where I am.

Regards,
Minsung


On Aug 17, 5:21 am, "tdom...@googlemail.com" <tdom...@googlemail.com>
wrote:

Hao HU

unread,
Jun 20, 2013, 6:04:17 PM6/20/13
to andar_android_a...@googlegroups.com
Hello, thanks tobias.
However in your repository I could not find the this version of AndAR, could you please tell me where it is?

Hao HU

unread,
Jun 20, 2013, 6:15:29 PM6/20/13
to andar_android_a...@googlegroups.com
If I get the A's coordinates in the camera's coordinate system, C's coordinates in the camera's coordinate system. And B is a physical square between A and C, then I could calculate the x coord and y coord of B in the camera's coordinate system.

Then how could I calculate the relative coordinate of B in A's model coordinate system? In order that I could use gltranslatef to translate to B'place and draw superimposed object there?
Reply all
Reply to author
Forward
0 new messages