more updates. I've gotten something to work. But it flickers. I see a scaled image on the phone display (basically entire phone UI is shrunk down to 80% of original)
but its intermittent. I see the shrunk version for a time, and then the normal scale (1.0f) version for sometime. And this goes back and forth.
String8 ProgramCache::generateVertexShader(const Key& needs) {
Formatter vs;
if (needs.isTexturing()) {
vs << "attribute vec4 texCoords;"
<< "varying vec2 outTexCoords;";
}
vs << "attribute vec4 position;"
<< "uniform mat4 projection;"
<< "uniform mat4 texture;"
<< "uniform mat4 modelView;"
<< "void main(void) {" << indent
<< "gl_Position = projection * modelView * position;";
if (needs.isTexturing()) {
vs << "outTexCoords = (texture * texCoords).st;";
}
vs << dedent << "}";
return vs.getString();
}
so basically I have created a new 4x4 modelview matrix.
I have also create the setter function similar to the one for the existing projection matrix.
In the rendering cycle, just before engine.drawMesh, I call a function to set the modelView uniform.
Towards the end of Layer::drawWithOpenGL (also in clearWithOpenGL)
RenderEngine& engine(mFlinger->getRenderEngine());
engine.compressLayer(); // <------------------------------------- my addition, basically sets the modelView matrix (in mState which seems to be further updated in a call from ProgramCache->setUniforms())
engine.setupLayerBlending(mPremultipliedAlpha, isOpaque(), s.alpha);
engine.drawMesh(mMesh);
engine.disableBlending();
Can anyone tell me why it is intermittently (seemingly random) scaling down and scaling back to normal?