why the vertexbuffer takes only two coordinates (x, y)? is gles11 just for 2d? :D
Method Rethink:Void(indizies:Int[])
Local vList:List<Float> = new List<Float>
For Local v:Vertex = EachIn self.vertices
vList.AddLast(v.vertexdata.x)
vList.AddLast(v.vertexdata.y)
'vList.AddLast(v.vertexdata.z)
Next
Local vArray:Float[] = vList.ToArray() ; vList = Null
Self.vertexBuffer = DataBuffer.Create(vArray.Length * 4)
Self.indexBuffer = DataBuffer.Create(indizies.Length * 2)
For Local i:Int = 0 To vArray.Length - 1
Self.vertexBuffer.PokeFloat(i * 4, vArray[i])
Next
For Local i:Int = 0 To indizies.Length - 1
Self.indexBuffer.PokeShort(i * 2, indizies[i])
Next
glBindBuffer(GL_ARRAY_BUFFER, Self.vbo)
glBufferData(GL_ARRAY_BUFFER, Self.vertexBuffer.Size(), Self.vertexBuffer, GL_STATIC_DRAW)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, Self.ibo)
glBufferData(GL_ELEMENT_ARRAY_BUFFER, Self.indexBuffer.Size(), Self.indexBuffer, GL_STATIC_DRAW)
End
|