Hi everyone ,
I have implemented an iOS app using the Image Target Sample . Its functionality is detect the Image ( displayed the 2d Image on the Target Image ) and display the distance from the Target Image .My problem is detection and distance are working fine upto 2 ft . But after 2 ft it is detecting the Image but not displaying the 2D Image on the Target Image . I have used the below code . Please tell me what will be the issue ? Thanks in advance
const QCAR::Trackable* trackable = state.getTrackable(0); QCAR::Vec2F targetSize = ((QCAR::ImageTarget *) trackable)->getSize(); QCAR::Matrix44F modelViewProjection; ShaderUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]); ShaderUtils::scalePoseMatrix(targetSize.data[0], targetSize.data[1], 1.0f, &modelViewMatrix.data[0]); ShaderUtils::multiplyMatrix(qUtils.projectionMatrix.data, &modelViewMatrix.data[0] , &modelViewProjection.data[0]); glUseProgram(shaderProgramID); glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*)obj3D.vertices); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*)obj3D.normals); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,(const GLvoid*)obj3D.texCoords); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, [obj3D.texture textureID]); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT,(const GLvoid*)obj3D.indices);
2D Image is not displaying after 2ft distance
Hi, at a first glance it might be just a problem with your far-distance clip plane, clipping your 3D model out;
you should find some code which looks like this:
2D Image is not displaying after 2ft distance
Hi AlessandroB
Thanks for your reply . I didn't used any function like you mentioned . Is there any other reason for my this scenario ?
2D Image is not displaying after 2ft distance
Hi, if you look at the Image Targets sample (or any of the Vuforia samples) you should find the function that I mentioned (
2D Image is not displaying after 2ft distance
Hi AlessandroB
Thank you so much for your reply . It helped me a lot
2D Image is not displaying after 2ft distance
You're welcome. Did that solve your issue ?
2D Image is not displaying after 2ft distance
Yes It have solved my issue and one more thing is Could you tell me how to get the projected 2D Imagesize (the Image which we have drawn once the target Image is tracked )? ( width and Height ) . Please let me know if my question not clear .
2D Image is not displaying after 2ft distance
Glad that the isseu was solved.
Concerning your second question: could you clarify a bit what you mean exactly by "projected size" ?
2D Image is not displaying after 2ft distance
HI
2D Image is not displaying after 2ft distance
Hi, if the image is rendered on the Image Target as a texture, it will not look rectangular, but it will appear somehow skewed (like a trapezoid), due to the position of the camera with respect to the target, and due to the persepctive projection (unless you assume that the device screen is exact
2D Image is not displaying after 2ft distance
Hi Thank you for your reply . The texture looks like a Rectangle .
2D Image is not displaying after 2ft distance
Hi, sorry, but that code renders the texture in 3D (i.e.