sketchup and error in render

Hi,

I have a problem using opengl on android to draw a simple rectangle.
This is what I did.

I drew a simple rectangle with sketchup. I exported the result using
a 3d-model collada .dae file. I copied the vertices data from
the .dae (xml) file and put in an array as X, Y, Z repeating. I then drew the triangles
using stripe mode. The result is nearly a rectangle. It is missing a triangle on
each face.

Here is the relevant portion of code and the result.
From the xml,
<float_array id=“ID8” count=“72”>22.62976164142344 29.52755905511811 0 0 0 0 0 29.52755905511811 0 22.62976164142344 0 0 22.62976164142344 0 13.77952755905512 0 0 0 22.62976164142344 0 0 0 0 13.77952755905512 0 29.52755905511811 13.77952755905512 0 0 0 0 0 13.77952755905512 0 29.52755905511811 0 0 29.52755905511811 13.77952755905512 22.62976164142344 29.52755905511811 0 0 29.52755905511811 0 22.62976164142344 29.52755905511811 13.77952755905512 22.62976164142344 29.52755905511811 0 22.62976164142344 0 13.77952755905512 22.62976164142344 0 0 22.62976164142344 29.52755905511811 13.77952755905512 22.62976164142344 0 13.77952755905512 0 29.52755905511811 13.77952755905512 0 0 13.77952755905512 22.62976164142344 29.52755905511811 13.77952755905512</float_array>

became

	float vertices[] = {
			22.62976164142344f, 29.52755905511811f, 0,
			0, 0, 0,
			0, 29.52755905511811f, 0, ...}

and then I did this in my draw routine:

  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&lt;108/4; i=i+4) {
                  myDrawColor(gl,i);
                  gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP,i,4);//mode, first, count
          }
  }

the result is shown here
http://imgur.com/a/o3HTP

Please advise

John

I got the code working. There were three problems.

DrawArrays works forward through the vertex array. ie. you draw one element from the array at a time and then go to the next. You can not hop back and forth thru it.
Using the offset list in the .xml file I created an array that I could use with glDrawElements where it hops around in the vertices list.
You need to use unsigned short of the offset. I was using an integer and fixed which did not work.
Here is the resulting code that works. The problem was mine. Not the .xml file produced from sketchup.

public void draw(GL10 gl) {
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorsBuffer);
gl.glEnable(GL10.GL_COLOR_MATERIAL);
// Enable color tracking
gl.glEnable(GL10.GL_COLOR_MATERIAL);
gl.glDrawElements(GL10.GL_TRIANGLES, myoffsets.length, GL10.GL_UNSIGNED_SHORT, mIndicesBuffer); // mode, count, type, indices
}