Hi everyone,
Recently I've been working on a page curl effect in Opengl ES 2.0 for embedded systems. I've been able to write the model and surface deformation algorithm properly, but I have problems with rendering it with a texture. I have attached three screenshots showing exactly the problem I get when rendering the curl at certain angles of the deformation cylinder (yes, the page is deformed around a cylinder). The problem is that if the angle of the cylinder is higher than PI / 2 the texture renders all perfectly, but if it's smaller I get some transparent stripes which you can see through and if you make the angle even smaller the whole bended surface seems to be transparent for the page behind.
I have checked if it's not a problem of the mathematical model (the surface crossing itself), but it's not. I have also disabled face culling and alpha blending in this case and I'm out of ideas what can be wrong. I would be very grateful if somebody gave me a hint where to start from.
The vertex shader I use is very simple:
uniform mat4 uPositionMatrix;
uniform mat4 uMV;
attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec4 vTextureCoord;
void main()
{
vTextureCoord = aTextureCoord;
gl_Position = uPositionMatrix * aPosition;
}
Fragment shader (basic one):
// Fragment shader program
precision highp float;
varying vec2 vTextureCoord;
uniform sampler2D sTexture;
void main (void)
{
gl_FragColor = texture2D(sTexture, vTextureCoord);
}
I know I didn't give you a lot of details, but as I don't know where to start from I'll wait for any questions for more details.
Thanks in advance!
[attachment=17955:Screen-20130920154606519612.jpg]
[attachment=17956:Screen-20130920154613617023.jpg]
[attachment=17957:Screen-20130920154618177095.jpg]