Oh, and I was already using the Alpha (shaders and all that), and was unaware that a DOC was in the package. I was using the one on the site
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: EgonOlsen on July 17, 2011, 10:24:12 PM
With OpenGL ES 2.0, anti-aliasing becomes possible.
QuoteThe other problem is that nothing I do with the camera now changes the look of the water plane.I'm not sure I quite understand... You mean it's like the water isn't moving? Or it's not bumpy/wavy?
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform vec4 additionalColor;
uniform vec4 ambientColor;
uniform vec3 lightPositions[8];
attribute vec4 position;
attribute vec4 tangent;
attribute vec3 normal;
attribute vec2 texture0;
varying vec3 lightVec[3];
varying vec3 eyeVec;
varying vec2 texCoord;
void main(void)
{
texCoord = texture0.xy;
vec3 n = normalize(modelViewMatrix * vec4(normal,0.0)).xyz;
vec3 t = normalize(modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz;
vec3 b = tangent.w*cross(n, t);
vec3 vVertex = vec3(modelViewMatrix * position);
vec3 tmpVec = lightPositions[0].xyz - vVertex;
vec3 tmpVec1 = lightPositions[1].xyz - vVertex;
vec3 tmpVec2 = lightPositions[2].xyz - vVertex;
vec3 lv;
vec3 lv1;
vec3 lv2;
vec3 ev;
lv.x = dot(tmpVec, t);
lv.y = dot(tmpVec, b);
lv.z = dot(tmpVec, n);
lightVec[0]=lv;
lv1.x = dot(tmpVec1, t);
lv1.y = dot(tmpVec1, b);
lv1.z = dot(tmpVec1, n);
lightVec[1]=lv1;
lv2.x = dot(tmpVec2, t);
lv2.y = dot(tmpVec2, b);
lv2.z = dot(tmpVec2, n);
lightVec[2]=lv2;
tmpVec = vVertex*-1.0;
eyeVec.x = dot(tmpVec, t);
eyeVec.y = dot(tmpVec, b);
eyeVec.z = dot(tmpVec, n);
gl_Position = modelViewProjectionMatrix * position;
}
precision mediump float;
varying vec3 lightVec[3];
varying vec3 eyeVec;
varying vec2 texCoord;
uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform vec4 ambientColor;
uniform float invRadius;
void main ()
{
vec4 vAmbient = ambientColor;
vec3 vVec = normalize(eyeVec);
vec4 base = texture2D(textureUnit0, texCoord);
vec3 bump = normalize(texture2D(textureUnit1, texCoord).xyz * 2.0 - 1.0);
float distSqr = dot(lightVec[0], lightVec[0]);
float att = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0);
float distSqr1 = dot(lightVec[1], lightVec[1]);
float att1 = clamp(1.0 - invRadius * sqrt(distSqr1), 0.0, 1.0);
float distSqr2 = dot(lightVec[2], lightVec[2]);
float att2 = clamp(1.0 - invRadius * sqrt(distSqr2), 0.0, 1.0);
vec3 lVec = (lightVec[0] * inversesqrt(distSqr)) + (lightVec[1] * inversesqrt(distSqr1)) + (lightVec[2] * inversesqrt(distSqr2));
float diffuse = max(dot(lVec, bump), 0.0);
vec4 vDiffuse = vec4(diffuseColors[0],0) * diffuse;
float specular = pow(clamp(dot(reflect(-lVec, bump), vVec), 0.0, 1.0), 0.85);
vec4 vSpecular = vec4(specularColors[0],0) * specular;
vec4 col = (vDiffuse*base + vSpecular) * att;
vec4 col1 = (vDiffuse*base + vSpecular);
vec4 col2 = (vDiffuse*base + vSpecular);
gl_FragColor = col+col1+col2+(vAmbient*base + vDiffuse*base + vSpecular);
}
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform vec4 additionalColor;
uniform vec4 ambientColor;
uniform vec3 lightPositions[8];
attribute vec4 position;
attribute vec4 tangent;
attribute vec3 normal;
attribute vec2 texture0;
varying vec3 lightVec[2];
varying vec3 eyeVec;
varying vec2 texCoord;
void main(void)
{
texCoord = texture0.xy;
vec3 n = normalize(modelViewMatrix * vec4(normal,0.0)).xyz;
vec3 t = normalize(modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz;
vec3 b = tangent.w*cross(n, t);
vec3 vVertex = vec3(modelViewMatrix * position);
vec3 tmpVec = lightPositions[0].xyz - vVertex;
vec3 lv;
vec3 ev;
lv.x = dot(tmpVec, t);
lv.y = dot(tmpVec, b);
lv.z = dot(tmpVec, n);
lightVec[0]=lv;
tmpVec = vVertex*-1.0;
eyeVec.x = dot(tmpVec, t);
eyeVec.y = dot(tmpVec, b);
eyeVec.z = dot(tmpVec, n);
gl_Position = modelViewProjectionMatrix * position;
}
precision mediump float;
varying vec3 lightVec[2];
varying vec3 eyeVec;
varying vec2 texCoord;
uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform vec4 ambientColor;
uniform float invRadius;
void main ()
{
vec4 vAmbient = ambientColor;
vec3 vVec = normalize(eyeVec);
vec4 base = texture2D(textureUnit0, texCoord);
vec3 bump = normalize(texture2D(textureUnit1, texCoord).xyz * 2.0 - 1.0);
float distSqr = dot(lightVec[0], lightVec[0]);
float att = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0);
vec3 lVec = lightVec[0] * inversesqrt(distSqr);
float diffuse = max(dot(lVec, bump), 0.0);
vec4 vDiffuse = vec4(diffuseColors[0],0) * diffuse;
float specular = pow(clamp(dot(reflect(-lVec, bump), vVec), 0.0, 1.0), 0.85);
vec4 vSpecular = vec4(specularColors[0],0) * specular;
vec4 col = (vDiffuse*base + vSpecular) * att;
gl_FragColor = col+(vAmbient*base + vDiffuse*base + vSpecular) * att;
}
@Override
public Engine onCreateEngine() {
mRenderer = new MyRenderer(this);
return new WallpaperEngine(getBaseContext(), mRenderer);
}
private private EGL10 gL1; //and for everything else you'll see below.
this.gL1 = (EGL10) EGLContext.getEGL(); //An instance
final int[] version = new int[2]; //Initialization
this.gL1.eglInitialize(this.gL1Display, version); //Take a look at this line, because I think this is what you need.
this.gL1Config = this.gL1ConfigChooser.chooseConfig(this.gL1, this.gL1Display);
Page created in 0.032 seconds with 11 queries.