I am developing an android application in opengl ES2.0.In this Application I used to draw multiple lines and circles by touch event in GL surfaceView.
As opengl depen
Why don´t you provide one working example, so people actually could help?
From your code: I can´t see where do you create your line? Something like:
@Override public void onSurfaceCreated(GL10 gl, EGLConfig config){
...
mLine = new Lines();
...
}
As others already mentioned, in onDrawFrame always clear the buffer:
public void onDrawFrame(GL10 gl )
{
// Erase CL_COLOR_BUFFER
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
Set the camera:
// Set the camera position (View matrix)
Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
//
// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mViewMatrix, 0);
Draw:
line.draw( dx, dy, ux, uy );