On Thu, Oct 27, 2011 at 1:57 PM, Latimerius <[email protected]> wrote:
> 2011/10/27 John Davis <[email protected]>:
>> Latimerius,
>>
>> I think you are correct.  There is another section of the xml file:
>>                <triangles count="12" material="Material2">
>>                    <input offset="0" semantic="VERTEX" source="#ID7" />
>>                    <p>0 1 2 1 0 3 4 5 6 5 4 7 8 9 10 9 8 11 12 13 14
>> 13 12 15 16 17 18 17 16 19 20 21 22 21 20 23</p>
>>                </triangles>
>>
>> I did not notice until your note.  I looked at it further.  The
>> numbers are not consecutive.  It starts off as
>> 0 1 2 and ends in 23 but it appears that it is saying triangle
>> 4(counting from 1)  is specified by three vertices encoded at offset
>> 1.
>
> Actually, it is saying the first triangle has vertices 0, 1 and 2, the
> second one 1, 0 and 3, the next one 4, 5 and 6 etc.  The vertex
> indices run from 0 to 23 for 24 vertices.
>
>> I'll see if I can use this.  Be right back.
>
> I'm not as familiar with GL ES yet but in full GL you'd render indexed
> data by calling glEnableClientState (GL_INDEX_ARRAY) then
> glIndexPointer() and glDrawElements().
>

That is what I kind of what I tried to do (I used GL_VERTEX_ARRAY,
INDEX_ARRAY was not there.):

Using this as a guide:
http://www.songho.ca/opengl/gl_vertexarray.html

        public void draw(GL10 gl) {
                // 
http://pyopengl.sourceforge.net/documentation/ref/gl/vertexpointer.html
                gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
                gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);         
                gl.glDrawElements(GL10.GL_TRIANGLES, 24, GL10.GL_FIXED,
mIndicesBuffer); // mode, count, type, indices
                gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        }

It did not display anything though.

-- 
John F. Davis

独树一帜

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to