84 |
84 |
|
85 |
85 |
private static final String TAG = Distorted.class.getSimpleName();
|
86 |
86 |
private static boolean mInitialized = false;
|
87 |
|
|
88 |
|
private static int mProgramH; // handle to our shading program.
|
89 |
|
private static int mTextureUniformH; // the texture.
|
90 |
87 |
|
91 |
|
static int mPositionH; // model position information
|
92 |
|
static int mNormalH; // model normal information.
|
93 |
|
static int mTextureCoordH; // model texture coordinate information.
|
|
88 |
static int mPositionH; // model position information
|
|
89 |
static int mNormalH; // model normal information.
|
|
90 |
static int mTextureCoordH; // model texture coordinate information.
|
94 |
91 |
|
95 |
92 |
static DistortedFramebuffer mFramebuffer = new DistortedFramebuffer(0); // output to the screen
|
96 |
93 |
|
... | ... | |
325 |
322 |
final int vertexShaderHandle = compileShader(GLES20.GL_VERTEX_SHADER , vertexShader );
|
326 |
323 |
final int fragmentShaderHandle = compileShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader);
|
327 |
324 |
|
328 |
|
mProgramH = createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[] {"a_Position", "a_Color", "a_Normal", "a_TexCoordinate"});
|
|
325 |
int programH = createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[] {"a_Position", "a_Color", "a_Normal", "a_TexCoordinate"});
|
329 |
326 |
|
330 |
327 |
mFramebuffer.setProjection(60.0f,0.0f,0.0f);
|
331 |
328 |
|
332 |
|
GLES20.glUseProgram(mProgramH);
|
|
329 |
GLES20.glUseProgram(programH);
|
333 |
330 |
|
334 |
|
mTextureUniformH = GLES20.glGetUniformLocation(mProgramH, "u_Texture");
|
335 |
|
mPositionH = GLES20.glGetAttribLocation( mProgramH, "a_Position");
|
336 |
|
mNormalH = GLES20.glGetAttribLocation( mProgramH, "a_Normal");
|
337 |
|
mTextureCoordH = GLES20.glGetAttribLocation( mProgramH, "a_TexCoordinate");
|
|
331 |
int textureUniformH = GLES20.glGetUniformLocation(programH, "u_Texture");
|
|
332 |
mPositionH = GLES20.glGetAttribLocation( programH, "a_Position");
|
|
333 |
mNormalH = GLES20.glGetAttribLocation( programH, "a_Normal");
|
|
334 |
mTextureCoordH = GLES20.glGetAttribLocation( programH, "a_TexCoordinate");
|
338 |
335 |
|
339 |
336 |
GLES20.glEnable (GLES20.GL_DEPTH_TEST);
|
340 |
337 |
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
|
... | ... | |
344 |
341 |
GLES20.glCullFace(GLES20.GL_BACK);
|
345 |
342 |
GLES20.glFrontFace(GLES20.GL_CW);
|
346 |
343 |
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
347 |
|
GLES20.glUniform1i(mTextureUniformH, 0);
|
|
344 |
GLES20.glUniform1i(textureUniformH, 0);
|
348 |
345 |
|
349 |
|
EffectQueueFragment.getUniforms(mProgramH);
|
350 |
|
EffectQueueVertex.getUniforms(mProgramH);
|
351 |
|
EffectQueueMatrix.getUniforms(mProgramH);
|
|
346 |
EffectQueueFragment.getUniforms(programH);
|
|
347 |
EffectQueueVertex.getUniforms(programH);
|
|
348 |
EffectQueueMatrix.getUniforms(programH);
|
352 |
349 |
|
353 |
350 |
GLES20.glEnableVertexAttribArray(mPositionH);
|
354 |
351 |
GLES20.glEnableVertexAttribArray(mNormalH);
|
Minor