openglesを使用して画面にいくつかのポイントを表示しようとしています。これがondrawのコードです:
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glColor4f(0, 255, 0, 0);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, buffer);
gl.glDrawArrays(GL10.GL_POINTS, 0, points.length);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
誰かが私が間違っていることを教えてもらえますか?
編集:バッファとポイントを生成するコード
points = new float[12288];
int pos = 0;
for (float y = 0; y < 64; y++) {
for (float x = 0; x < 64; x++) {
points[pos++] = x/100;
points[pos++] = y/100;
points[pos++] = 0;
}
}
ByteBuffer vertexByteBuffer = ByteBuffer.allocateDirect(points.length * 4);
vertexByteBuffer.order(ByteOrder.nativeOrder());
// allocates the memory from the byte buffer
buffer = vertexByteBuffer.asFloatBuffer();
// fill the vertexBuffer with the vertices
buffer.put(points);
// set the cursor position to the beginning of the buffer
buffer.position(0);
およびlogcatでのエラー:
04-17 06:38:11.296:A / libc(24276):0x41719000での致命的な信号11(SIGSEGV)(コード= 2)
このエラーはgl.glDrawArraysで発生します