"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Outline target area w/ line

I am doing a simple exercise w/ the AR SDK. Similar how the buttons are outlined w/ a square draw on the screen in the VirtualButtons example, I would like to outline a target w/ opengl. For example: A target is found - then around it's border draw a line. What would be the process to do this. Right now I have the target pose: const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx); QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose()); What do I do from here? I've just tried drawing w/ that matrix but it just draws weird lines: glVertexAttribPointer(gvPositionHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &modelViewMatrix.data[0]); glDrawArrays(GL_LINES, 0, 12); How can I outline the target area w/ a line?

The modelview matrix is used for positioning the target in relation to the camera. It is not an array of vertices for the corners of the target, which is what you want. Using that modelview matrix, you can assume that the center of the target is at the world origin (0, 0, 0).

[QUOTE=ksiva] Take a look at the vbVertices array in the VirtualButtons sample to understand how to set up the corner vertices for line rendering. [/QUOTE] HI, this is my code to render a border around the image target per your suggestions. It doesn't work yet and I was hoping for corrections.

So close! You're forgetting to bind a shader program. If you're working with the VirtualButtons sample you probably want this: [CODE] glUseProgram(vbShaderProgramID); [/CODE] Then comment the call to glUniformMatrix4fv back in.

Hi, thanks for your support. I tried what you suggested and for simplicity, I'm just drawing a triangle now. It draws a static triangle on the screen (i.e. it just stays flat on screen plane). If I uncomment the glUseProgram line for some reason it doesn't draw the triangle anymore.

Are you trying to use OpenGL ES 1.x? Shaders are required for OpenGL ES 2.0, and both of your code samples are written for OpenGL ES 2.0. I just opened the VirtualButtons project, commented out all the code in the renderFrame method and replaced it with your code and my suggested changes.

Yes opengl 2.0. Hmm, I agree. I copied my render code to the VirtualButtons project and it worked. When I comment glUseProgram on my project it draws a triangle on the plane of the screen. However, if uncomment glUseProgram I see nothing drawn on the screen.

[CODE] So it's not possible to rotate/scale/move the objects w/o using shaders? I can't just use matrix transforms? [/CODE] If you were using OpenGL ES 1.1 you could apply transforms directly to the matrix stack.

Thanks for the clarification. I'll have to study up more on shaders, but from what I understand it's a script that opengl can to the gpu instead of the cpu right? For faster performance... In what language are those shaders written in the sample projects?

Thanks. A couple more clarifications: The modelViewMatrix is the 3d pose which is a marix which represents where the target is relative from the viewer, right? What is the modelViewProjection matrix? What is the modelViewProjection matrix? What does multiplying the projection matrix by the mode

http://www.opengl.org/resources/faq/technical/transformations.htm The vertex shader multiplies each vertex in our model by the modelviewProjection matrix.

My question is in the scope of the Unity extension. I'm on Unity 5.4.

How can I get the array of points in the camera frame coordinates that bounds the tracked image target? With that, I could draw the outline of the target on the video background texture.