Log in or register to post comments

Interaction with marker

June 26, 2013 - 12:53am #6

Hi everybody!

I want help to create my own marker  with witch i can interact like the vuforia Virtual Buttons sample.

I want to interact  with an objet on my marker. Wath can i do with vuforia sdk?

Thanks you for your answers.

Interaction with marker

June 26, 2013 - 1:41am #5

Hi, I'm not sure I understand the question:

if you want to implement something like the Virtual Buttons sample, you can go with it and have a look at the Virtual Buttons sample code.

 

Interaction with marker

June 29, 2013 - 6:50am #4

hai,,

i new bee in AR and vuforia sdk,,

can I add another 3d models in the same marker for virtual button sample,, can you give me some tutorial about this,,

please help me,,
 

Interaction with marker

June 29, 2013 - 11:30am #3

yes, it is possible to render more 3D models for the same target; this is basically just a matter of duplicating the OpenGL code that you can find in the renderFrame() function (see code in VirtualButtons.cpp file).

We don't have a tutorial for that, but that's not complicated to do (and it is basically about OpenGL programming)

 

 

 

Interaction with marker

June 29, 2013 - 11:14pm #2

thank you AlessandroB for you reply,,

I do not quite understand about openGL,, but i try your suggestion,,i duplicate the code

static const float kgamelanScale = 100.f;
static const float kcubeScale = 200.f;

JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_VirtualButtons_VirtualButtonsRenderer_renderFrame(JNIEnv * env, jobject obj)
{

//some code

// We only render if there is something on the array

 if (vbCounter>0)
                {

//some code

}

// this my first object

// Assumptions:
                assert(textureIndex < textureCount);
                const Texture* const thisTexture = textures[textureIndex];

                // Scale 3D model
                QCAR::Matrix44F modelViewScaled = modelViewMatrix;
                SampleUtils::scalePoseMatrix(kgamelanScale, kgamelanScale, kgamelanScale,
                                             &modelViewScaled.data[0]);

                QCAR::Matrix44F modelViewProjectionScaled;
                SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
                                            &modelViewScaled.data[0],
                                            &modelViewProjectionScaled.data[0]);

                // Render 3D model
                glUseProgram(shaderProgramID);

                glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
                                      (const GLvoid*) &gamelanVerts[0]);
                glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
                                      (const GLvoid*) &gamelanNormals[0]);
                glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
                                      (const GLvoid*) &gamelanTexCoords[0]);

                glEnableVertexAttribArray(vertexHandle);
                glEnableVertexAttribArray(normalHandle);
                glEnableVertexAttribArray(textureCoordHandle);

                glActiveTexture(GL_TEXTURE0);
                glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
                glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                                   (GLfloat*)&modelViewProjectionScaled.data[0] );
                glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/);
              glDrawArrays(GL_TRIANGLES, 0, gamelanNumVerts);

 

//and this my second object
 // Assumptions:
//                            assert(textureIndex < textureCount);
//                            const Texture* const thisTexture = textures[textureIndex];

                            // Scale 3D model
//                            QCAR::Matrix44F modelViewScaled = modelViewMatrix;
                            SampleUtils::scalePoseMatrix(kcubeScale, kcubeScale, kcubeScale,
                                                         &modelViewScaled.data[0]);

//                            QCAR::Matrix44F modelViewProjectionScaled;
                            SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
                                                        &modelViewScaled.data[0],
                                                        &modelViewProjectionScaled.data[0]);

                            // Render 3D model
                            glUseProgram(shaderProgramID);

                            glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
                                                  (const GLvoid*) &cubeVerts[0]);
                            glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
                                                  (const GLvoid*) &cubeNormals[0]);
 //                           glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
 //                                                 (const GLvoid*) &cubeTexCoords[0]);

                            glEnableVertexAttribArray(vertexHandle);
                            glEnableVertexAttribArray(normalHandle);
                            glEnableVertexAttribArray(textureCoordHandle);

                            glActiveTexture(GL_TEXTURE0);
                            glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID);
                            glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
                                               (GLfloat*)&modelViewProjectionScaled.data[0] );
                            glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/);
                            glDrawArrays(GL_TRIANGLES, 0, cubeNumVerts);

                           SampleUtils::checkGlError("VirtualButtons renderFrame");

                glDisable(GL_DEPTH_TEST);

                glDisableVertexAttribArray(vertexHandle);
                glDisableVertexAttribArray(normalHandle);
                glDisableVertexAttribArray(textureCoordHandle);

                QCAR::Renderer::getInstance().end();

 

when i run my application, i  just see the first object,

i already ndk-build when i change the code,, did I do this correct? what is wrong?

sorry for my fool,,

please help me again :)
 

 

Interaction with marker

July 3, 2013 - 2:21am #1

Looking at the code, I don't see anything wrong;

have you tried changing the order of rendering of the 2 objects ?  is it always the same object that is not visible ?

 

Log in or register to post comments