public void onDrawFrame(GL10 gl) { // define the color we want to be displayed as the "clipping wall" gl.glClearColor(_red, _green, _blue, 1.0f); // reset the matrix - good to fix the rotation to a static angle gl.glLoadIdentity(); // clear the color buffer to show the ClearColor we called above... gl.glClear(GL10_GL_COLOR_BUFFER_BIT); // draw the static triangle gl.glColor4f(0f, 0.5f, 0f, 0.5f); gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBufferStatic); gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBufferStatic); // set rotation for the non-static triangle gl.glRotatef(_angle, 0f, 1f, 0f); gl.glColor4f(0.5f, 0f, 0f, 0.5f); gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBuffer); gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBuffer); }
public void onDrawFrame(GL10 gl) { // clear the color buffer and the depth buffer gl.glClear(GL10_GL_COLOR_BUFFER_BIT | GL10_GL_DEPTH_BUFFER_BIT); gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBuffer); gl.glColorPointer(4, GL10_GL_FLOAT, 0, _colorBuffer); for (int i = 1; i <= 10; i++) { gl.glLoadIdentity(); gl.glTranslatef(0.0f, -1f, -1.0f + -1.5f * i); // set rotation gl.glRotatef(_xAngle, 1f, 0f, 0f); gl.glRotatef(_yAngle, 0f, 1f, 0f); gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBuffer); } }
public void onDrawFrame(GL10 gl) { // define the color we want to be displayed as the "clipping wall" gl.glClearColor(_red, _green, _blue, 1.0f); // clear the color buffer to show the ClearColor we called above... gl.glClear(GL10_GL_COLOR_BUFFER_BIT); // set rotation gl.glRotatef(_angle, 0f, 1f, 0f); // set the color of our element gl.glColor4f(0.5f, 0f, 0f, 0.5f); // define the vertices we want to draw gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBuffer); // finally draw the vertices gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBuffer); }
public void onDrawFrame(GL10 gl) { // define the color we want to be displayed as the "clipping wall" gl.glClearColor(_red, _green, _blue, 1.0f); // reset the matrix - good to fix the rotation to a static angle gl.glLoadIdentity(); // clear the color buffer to show the ClearColor we called above... gl.glClear(GL10_GL_COLOR_BUFFER_BIT); // set rotation for the non-static triangle gl.glRotatef(_angle, 0f, 1f, 0f); gl.glColor4f(0.5f, 0f, 0f, 0.5f); gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBuffer); gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBuffer); // gl.glColor4f(0.5f, 0f, 0f, 0.5f); gl.glVertexPointer(3, GL10_GL_FLOAT, 0, _vertexBuffer); gl.glColorPointer(4, GL10_GL_FLOAT, 0, _colorBuffer); gl.glDrawElements(GL10_GL_TRIANGLES, _nrOfVertices, GL10_GL_UNSIGNED_SHORT, _indexBuffer); }