android开发者!我有麻烦了.我的Android应用程序必须使用OpenGL绘制几行.我从这个例子开始,重写了它.它抛出了IllegalArgumentException:在调用GLES20.glVertexAttribPointer时必须使用本机命令直接缓冲区.我不明白为什么,因为我把它设置为本机顺序,就像我使用的例子.这是我完整的OpenGLRenderer类:(在创建此类的实例时,我使用带有float []参数的第二个构造函数)
public class OpenGLRenderer implements GLSurfaceView.Renderer {
final int COORDS_PER_VERTEX = 3;
final int NR_OF_LINES;
final int NR_OF_VERTECES;
final int VertexStride = COORDS_PER_VERTEX * 4; // 4 bytes per vertex
final int NR_OF_VERTECES_PER_LINE = 2;
final int BYTES_PER_VERTEX = 4;
private FloatBuffer bufferVertecesLines;
private float[] arrayVertecesLines;
//private FloatBuffer ColorBuffer;
// Set color with red, green, blue and alpha (opacity) values
float color[] = { 0.3f, 0.7f, 0.2f, 1.0f };
private int GlProgram;
private int PositionHandle;
private int …Run Code Online (Sandbox Code Playgroud)