Hi, I am drawing a texture in Videoplayback demo in Opengl in Xcode. I want to find heght and width of current texture which is being draw. I am new bee in Open gl and couldn't understand code easily
Here is how i am drawing texture.
QCAR::Matrix44F modelViewMatrixButton = QCAR::Tool::convertPose2GLMatrix(trackablePose);
QCAR::Matrix44F modelViewProjectionButton;
ShaderUtils::translatePoseMatrix(0.0f, 0.0f, videoData[playerIndex].targetPositiveDimensions.data[1] / SCALE_ICON_TRANSLATION, &modelViewMatrixButton.data[0]);
ShaderUtils::scalePoseMatrix(videoData[playerIndex].targetPositiveDimensions.data[1] * SCALE_ICON,
videoData[playerIndex].targetPositiveDimensions.data[1] * SCALE_ICON,
videoData[playerIndex].targetPositiveDimensions.data[1] / 3.0,
&modelViewMatrixButton.data[0]);
NSLog(@"Size of Scale Pose Matrix of 0 : %f",videoData[playerIndex].targetPositiveDimensions.data[0]);
NSLog(@"Size of Scale Pose Matrix of 1 : %f",videoData[playerIndex].targetPositiveDimensions.data[1]);
ShaderUtils::multiplyMatrix(&qUtils.projectionMatrix.data[0],
&modelViewMatrixButton.data[0] ,
&modelViewProjectionButton.data[0]);
glDepthFunc(GL_LEQUAL);
glUseProgram(shaderProgramID);
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, quadVertices);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, quadNormals);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, quadTexCoords);
glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);
// Blend the icon over the background
//use to make transparent image
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, index);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjectionButton.data[0] );
//***comment for block icon play, puase etc..
glDrawElements(GL_TRIANGLES, NUM_QUAD_INDEX, GL_UNSIGNED_SHORT, quadIndices);
glDisable(GL_BLEND);
glDisableVertexAttribArray(vertexHandle);
glDisableVertexAttribArray(normalHandle);
glDisableVertexAttribArray(textureCoordHandle);
glUseProgram(0);
glDepthFunc(GL_LESS);
SCALE_ICON value is equal to 5. Kindly help me on that. I want height and width in float. Thanks in advance.
Hi, are you looking for the
Hi,
are you looking for the width and height of the image in pixels ?
or are you interested in the size of the rectangle (in 3D space) on which the video texture is rendered ?