revert to regular shader
This commit is contained in:
1 parent
490f8973d2
commit
2ddae706eb
3 files changed
+18
-13
No files matched your search
@@ -93,10 +93,10 @@ public class MyRenderer implements GLSurfaceView.Renderer
|
||||
public void onSurfaceCreated(GL10 unused, EGLConfig config)
|
||||
{
|
||||
final float attribs[] = {
|
||||
1, 1,
|
||||
0, 1,
|
||||
0, 0,
|
||||
1, 0
|
||||
1, 1, 0.8f, 0.8f, 1,
|
||||
0, 1, 0, 0, 1,
|
||||
0, 0, 0.8f, 0.8f, 1,
|
||||
1, 0, 0, 0, 1
|
||||
};
|
||||
checkGLError("onSurfaceCreated");
|
||||
ByteBuffer bb = ByteBuffer.allocateDirect(attribs.length * 4);
|
||||
@@ -150,13 +150,19 @@ public class MyRenderer implements GLSurfaceView.Renderer
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
int attr_pos = GLES20.glGetAttribLocation(m_program, "pos");
|
||||
int attr_color = GLES20.glGetAttribLocation(m_program, "color");
|
||||
checkGLError("glGetAttribLocation");
|
||||
|
||||
GLES20.glEnableVertexAttribArray(attr_pos);
|
||||
GLES20.glEnableVertexAttribArray(attr_color);
|
||||
checkGLError("glEnableVertexAttribArray");
|
||||
|
||||
m_quad_attrib_buffer.position(0);
|
||||
GLES20.glVertexAttribPointer(attr_pos, 2, GLES20.GL_FLOAT, false,
|
||||
2 * 4, m_quad_attrib_buffer);
|
||||
5 * 4, m_quad_attrib_buffer);
|
||||
m_quad_attrib_buffer.position(2);
|
||||
GLES20.glVertexAttribPointer(attr_color, 3, GLES20.GL_FLOAT, false,
|
||||
5 * 4, m_quad_attrib_buffer);
|
||||
checkGLError("glVertexAttribPointer");
|
||||
|
||||
for (int y = 0; y < GRID_HEIGHT; y++)
|
||||
@@ -166,18 +172,17 @@ public class MyRenderer implements GLSurfaceView.Renderer
|
||||
Matrix.setIdentityM(m_modelview, 0);
|
||||
Matrix.translateM(m_modelview, 0,
|
||||
x - GRID_WIDTH / 2.0f, y - GRID_HEIGHT / 2.0f, 0);
|
||||
Matrix.scaleM(m_modelview, 0, 0.9f, 0.9f, 0.9f);
|
||||
GLES20.glUniformMatrix4fv(
|
||||
GLES20.glGetUniformLocation(m_program, "modelview"),
|
||||
1, false, m_modelview, 0);
|
||||
|
||||
m_quad_attrib_buffer.position(0);
|
||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_FAN, 0, 4);
|
||||
checkGLError("glDrawArrays");
|
||||
}
|
||||
}
|
||||
|
||||
GLES20.glDisableVertexAttribArray(attr_pos);
|
||||
GLES20.glDisableVertexAttribArray(attr_color);
|
||||
checkGLError("glDisableVertexAttribArray");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user