SDK : GLator transform 3D issue
Hi everyone,
Maybe someone can help me:
I have successfully run the GLator sample plugin, and modified it to display a different layer (user selects a layer in the UI, the plugin checkouts out the layer and passes it to OpenGL to display it).
It works fine, however, I also want OpenGL to display the selected layer with its transform data (position, scale, rotation etc), even if it is 3D.
Here is the code I've modified inside of the RenderGL() method.
.....
// view matrix, mimic windows coordinates
vmath::Matrix4 ModelviewProjection = vmath::Matrix4::translation(vmath::Vector3(-1.0f, -1.0f, 0.0f)) * vmath::Matrix4::scale(vmath::Vector3(2.0 / float(widthL), 2.0 / float(heightL), 1.0f));
vmath::Matrix4 transformMatrix = A_Matrix4ToMatrix4(layerTransformMatrix4x4);
vmath::Matrix4 resultMatrix = ModelviewProjection * transformMatrix;
glBindTexture(GL_TEXTURE_2D, inputFrameTexture);
glUseProgram(renderContext->mProgramObjSu);
// program uniforms
GLint location = glGetUniformLocation(renderContext->mProgramObjSu, "ModelviewProjection");
glUniformMatrix4fv(location, 1, GL_FALSE, (GLfloat*)&resultMatrix);
.....
Explanation:
layerTransformMatrix4x4 is the transform matrix of the selected layer, that was retrieved using AEGP_GetLayerToWorldXform(). It contains all the transform data, even 3D. I then transform the matrix into a column matrix using A_Matrix4ToMatrix4(), and multiplied it with the ModelViewProjection matrix. The result is then passed to the vertex shader.
The problem: it works fine for 2d translations, however 3d translations (with a different Z) results in a transparent layer. It does not draw anything!
Am I missing something ?
Thanks
