I have a problem using opengl on android to draw a simple rectangle.
This is what I have done.
I drew a simple rectangle with sketchup. I exported the result using
a 3d-model collada .dae file. I then copied the vertices data from
the .dae (xml) file and put in an array. I copied the array in native
format to a float buffer. I then drew the triangles using stripe
mode. The result is nearly a rectangle. It is missing a triangle on
each surface.
Here is the relevant portion of code and the result.
public void draw(GL10 gl) {
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
// Enable color tracking
gl.glEnable(GL10.GL_COLOR_MATERIAL);
for (int i=0; i<108/4; i=i+4) {
myDrawColor(gl,i);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,i,4);// mode, first, count
}
}
the result is shown here
https://i.stack.imgur.com/KhnNz.jpg
I got the code working. There were three problems.
Here is the resulting code that works. The problem was mine. Not the .xml file produced from sketchup.