Hi folks!
I have a little performance problem here.
At the moment I'm uploading the vertices and texture coordinates
data on each call to the draw event of GLSurfaceView.
Sub glSv_Draw(gl As GL1)
gl.glClear(Bit.OR(gl.GL_COLOR_BUFFER_BIT, gl.GL_DEPTH_BUFFER_BIT))
' left out the transformations
gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
gl.glFrontFace(gl.GL_CW)
gl.glVertexPointerf(3,vertices2)
gl.glTexCoordPointerf(2,0,texture2)
Dim b As Int
Do While b<5036
gl.glBindTexture(gl.GL_TEXTURE_2D, textures(texturesToUse.Get(Floor(b/24))))
gl.glDrawArrays(gl.GL_TRIANGLE_STRIP,b, 4)
b=b+4
Loop
gl.glDisableClientState(gl.GL_VERTEX_ARRAY)
gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY)
End Sub
Of course this is good enough if you want to display a single rotationg cube
or something similar. My scene got quite complex though and the rendering is
noticeably jerky.
Now I heard about something magic called Vertex Buffer Objects, which essentially
uploads and keeps the geometry on the GPU.
Unfortunately I didn't find a way to convert the Java code to Basic4Android.
Does anybody have any experience with this?
Thanks!