By blackswan007
on Wed, 06/20/2012 - 17:12
Hi,
i am newbie in QCAR. i am facing difficultly in getting area of a rectangle which i have drawn besides MARKER with the help of QCAR::Rectangle.
I am getting coordinates for the rectangle using the following code.
[CODE]const QCAR::Trackable* trackable = state.getActiveTrackable(i);
QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());
//shani new
const QCAR::ImageTarget* imageTarget = static_cast(trackable);
QCAR::Vec2F::Vec2F screenPoint = imageTarget->getSize();
CGSize target;
target.width = screenPoint.data[0];
target.height = screenPoint.data[1];
//NSLog(@"screen point: %f, %f", screenPoint.data[0], screenPoint.data[1]);
CGRect rect = [self calcScreenCoordsOf:target inView:&modelViewMatrix.data[3] inPose:trackable->getPose()];
NSLog(@"%@",NSStringFromCGRect(rect));
[/CODE]
It give me coordinates but these are either very near to the MARKER or completely out of range of marker showing just the corner of Marker. what i want is that i must get the Rectangle coordinates which i have just drawn so that i could use that to put an image there.
This is besides MARKER not on the marker.
Can someone help me out. ?
Thanks
Re: Drawing Rectangle besides the marker and getting its coordin
Drawing Rectangle besides the marker and getting its coordinates
Hi blackswan007
I'm not entirely sure where you want to draw this rectangle.
I have got some code to draw a rectangle on top of the target i.e. a textured plane that overlays the Chips/stones if you think this would help?
N
Drawing Rectangle besides the marker and getting its coordinates
Can you please share the code ?
Sure, no problem
Take the image targets app and in EAGLView.mm using the following code at the top to define the plane:
Drawing Rectangle besides the marker
Thanks for sharing code, How can i make the rectangle away from the marker and also will i be able to get the image of that specific area ?
Drawing Rectangle besides the marker and getting its coordinates
"How can i make the rectangle away from the marker"
Drawing Rectangle besides the marker
hmmm okay many thanks. i am not actually openGL developer or know much of it. just had to drag myself for the company on this project.
anyways,
many many thanks for the time you took out for me.
Appreciated.
Drawing Rectangle besides the marker and getting its coordinates
No problem blackswan007
Once you get the hang of it, OGLes can start to click quite quickly - just go a step at a time.
However if you do want to do anything quite fancy, it is welll worth looking at Unity as you can progress far more quickly in a short a space of time :)
N
Drawing Rectangle besides the marker
This code works well to me. I tried to change the size of texture like 800x340pixel and got black texture. What do I need to change?
Drawing Rectangle besides the marker and getting its coordinates
Hi dofl,
I think you may be running into the fact that texture dimensions need to be power of two issue with OpenGL ES.
See this thread for more details, and links as to how to move forward with this: