Log in or register to post comments

Not able to add virtual buttons

September 23, 2012 - 5:28am #1

I am new to using vuforia. I was trying to add virtual buttons. I modified the dataset for the ImageTarget example as below.

Then when i test it i do not see any virtual buttons coming. (I did clean project ).

 

I tried to run the virtualbuttons project as well, here i can see the bouttons and yellow toepot. But when i click on the buttons i dont see

the color change for the pot.

 

Please help me to analyse and fix my issue. The posts in this forum is really helpful. Thanks a lot

<?

xml version="1.0"

?>

<

QCARConfig xmlns:xsi=

"http://www.w3.org/2001/XMLSchema-instance"

 

xsi:noNamespaceSchemaLocation="qcar_config.xsd" >

 

 

<Tracking>

 

 

<ImageTarget

 

name="stones"

 

size="247 173" >

 

 

<VirtualButton

 

name="red"

 

enabled="true"

 

rectangle="-108.68 -53.52 -75.75 -65.87" />

 

 

<VirtualButton

 

name="blue"

 

enabled="true"

 

rectangle="-45.28 -53.52 -12.35 -65.87" />

 

 

<VirtualButton

 

name="yellow"

 

enabled="true"

 

rectangle="14.82 -53.52 47.75 -65.87" />

 

</ImageTarget>

 

 

<ImageTarget

 

name="chips"

 

size="247 173" />

 

</Tracking>

 

</

QCARConfig

>

Not able to add virtual buttons

October 4, 2012 - 2:59pm #4

That border is drawn in VirtualButtons.cpp using a shader, see lines 454 - 471.

 

// Render frame around button
            glUseProgram(vbShaderProgramID);

            glVertexAttribPointer(vbVertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
                (const GLvoid*) &vbVertices[0]);

            glEnableVertexAttribArray(vbVertexHandle);

            glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                (GLfloat*)&modelViewProjection.data[0] );

            // We multiply by 8 because that's the number of vertices per button
            // The reason is that GL_LINES considers only pairs. So some vertices
            // must be repeated.
            glDrawArrays(GL_LINES, 0, target->getNumVirtualButtons()*8);

            SampleUtils::checkGlError("VirtualButtons drawButton");

            glDisableVertexAttribArray(vbVertexHandle);

Not able to add virtual buttons

September 24, 2012 - 11:29pm #3

Hi, Thank you very much for the reply .

I tried to touch the button assuming its position and found that button is getting triggered which confirms everything is fine.

But i have a question. In virtualButtons sample , i can see a small blank rectangle with white border coming on top of the actual button positions.

As i toggle this white border appear and disappears. How can i get this rectangle. I do not see anything other than creating / destrying the buttons. Then what is the magic

Not able to add virtual buttons

September 24, 2012 - 10:53am #2

The buttons are invisible. They are simply a region of the image target, defined by their rectange, which will be analyzed to determine if the features in that rectangle are visible. If not, it is assumed that they are being occluded, and the button has been activated.

To test your VB's check the run session log for messages indicating that the button is being triggered.

Log in or register to post comments