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);
Hi, sorry, but that code renders the texture in 3D (i.e. aligned with tthe image target), so in your camera view it will look "in perspective", thus trapezoid, unless you look at the target with the camera device aligned with the target, as I said (try to look at the target from a 45 degrees angle for instance); that's why i don't get your question...