i started playing with OpenGL and was wondering about a growing of my triangle when I let it rotate....
To see it better I rotate at an angle and than at the same angle in the other direction. So normally nothing should be visible but you can see my triangle growing!
My onDrawFrame method:
Using java Syntax Highlighting
- @Override
- 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 and the depth buffer to show the ClearColor
- // we called above...
- gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
- initTriangle();
- 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);
- // set rotation
- gl.glRotatef(100, 0f, 1f, 0f);
- gl.glRotatef(-100, 0f, 1f, 0f);
- initStaticTriangle();
- 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);
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Some ideas?



