Open GoogleCodeExporter opened 9 years ago
I also tried to get the marker coordinate from the matrix which we can get from
getTransMat() in ARObject class. The returned matrix has a changing value but
the values in the most right column does not reflect the correct marker
position. it only ranges in somewhere around the upper left corner of the
screen.
Original comment by cecilia...@gmail.com
on 20 May 2011 at 3:51
Yeah can please someone tell how to get Marker Co-Ordinates. In the arUTIl.c
file there is a comment that it is included in some current matrix.How Can I
get as I need to calculate where is the marker position on the screen.
Original comment by mohammad...@gmail.com
on 15 Jul 2011 at 2:21
hey guys,
did u all find anything, regarding the x,y position of marker related to screen.
plz let me know
- shashank
Original comment by shashank...@gmail.com
on 23 Aug 2011 at 6:27
Hi everyone,I just solve the problem,if you guys want to get the rawX and rawY
in screen,you can use the function gluProject,because opengl default sets the
original point(0,0,0) in the center of the marker,so we can use the function by
following method:
gl.gluProject(0f, 0f, 0f,glMatrix, 0,glCameraMatrix, 0,viewport,
0,windowCoords, 0);
And then windowCoords will contain the raw value.
PS:I have test the values by using the OnTouch event getRawX() and getRawY(),
and the vaule is the same.
If you guys have any problem,please mail to me,I'm glad to help you guys!
Original comment by hijam...@gmail.com
on 25 Feb 2012 at 11:29
Someone managed to make it work?
I've tried using all the methods proposed but not working
Original comment by diou.ber...@gmail.com
on 26 Mar 2013 at 2:47
I solved this issue thanks to clues received from Diou.
We have to create a class eg Projector:
package edu.dhbw.andar.sample;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11;
import android.graphics.Point;
import android.opengl.GLU;
public class Projector {
int[] viewport = new int[4];
float[] modelview = new float[16];
float[] projection = new float[16];
float[] vector = new float[4];
public void setViewport(GL10 gl) {
gl.glGetIntegerv(GL11.GL_VIEWPORT, viewport, 0);
}
public synchronized Point getScreenCoords(double[] transMat, GL10 gl) {
GL11 gl11 = (GL11) gl;
gl11.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, modelview, 0);
gl11.glGetFloatv(GL11.GL_PROJECTION_MATRIX, projection, 0);
GLU.gluProject((float) transMat[0], (float) transMat[1],(float) transMat[1], modelview, 0, projection, 0, viewport, 0, vector, 0);
Point p = new Point((int) vector[0], (int) (viewport[3] - vector[1]));
return p;
}
}
Then in class CustomObject:
Projector projector = new Projector();
In method public final void draw(GL10 gl)
projector.setViewport(gl);
Point xy = projector.getScreenCoords(getTransMatrix(), gl);
And xy are our screen coordinates.
Original comment by tzonk1...@gmail.com
on 4 Dec 2013 at 12:12
Original issue reported on code.google.com by
cecilia...@gmail.com
on 20 May 2011 at 1:20