almost, but you need to bump the pointer instead of using cubeVertices
for all 3;

Well in my case I was using all GL_FLOAT, I think mixing float, byte &
short complicates the offset. Maybe the offset is in bytes and you
need 7*sizeof(). Truth is I have not done it yet. I have just been
reading up on it. I am using non-interleaved data for now. I think
with the FloatBuffer class you can do the pointer manipulation to get
the offset pointer.

On Nov 25, 9:51 am, Bartek Teodorczyk <[email protected]> wrote:
> Are you saying that complete vertex definition in your example should
> look like:
>
> gl.glVertexPointer(3, GL10.GL_FLOAT, 7, cubeVertices);
> gl.glColorPointer(4, GL10.GL_UNSIGNED_BYTE, 7, cubeVertices);
> gl.glNormalPointer(GL_SHORT, 7, cubeVertices);
>
> ? But how to specify offset for cubeVertices in glColorPointer and
> glNormalPointer?
>
> BR,
> Bartek Teodorczyk
>
> On Nov 25, 4:31 pm, Marc <[email protected]> wrote:
>
>
>
> > I am fairly new to this too, so my reply is sort of a guess, but I
> > think it my be helpful anyhow. I am rendering 3d models exported from
> > blender this way though.
>
> > for me I was doing:
> >  gl.glVertexPointer(3, GL10.GL_FLOAT, 0, cubeVertices);
>
> > instead of:
> >   gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex);
> >   glVertexPointer(3, GL_FIXED, 0, 0);
>
> > so for interleaved data:
> >  gl.glVertexPointer(3, GL10.GL_FLOAT, 7, cubeVertices);
> >  the last parameter is the number of data points, and the 2nd to last
> > is how many to skip after each row. So it reads 3 vertices then skips
> > 4 (color) then skips 3 (normals) then reads more vertices. The color
> > and normal pointer calls are the same except the pointer to the data
> > is offset by 4 and 7.
>
> > On Nov 24, 10:37 am, Bartek Teodorczyk <[email protected]> wrote:
>
> > > Hi,
>
> > > Passing separate vertex data is straightforward and works correctly,
> > > e.g.:
>
> > > gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, vertexBufferIndex);
> > > glVertexPointer(3, GL_FIXED, 0, 0);
> > > gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, colorBufferIndex);
> > > glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
> > > gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, normalBufferIndex);
> > > glNormalPointer(GL_FIXED, 0, 0);
>
> > > But what to do when the vertex data buffer is shared and provided as
> > > interleaved? I assume that glBindBuffer method has to called only one
> > > time at the beginning. What should be the last parameter of
> > > glVertexPointer, glColorPointer and glNormalPointer methods?
>
> > > BR,
> > > Bartek Teodorczyk

-- 
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