私はGL_UNSIGNED_INT_2_10_10_10_REVでglVertexAttribPを使用しようとしましたが、ある時点で立ち往生しました。
ここに私のコードがあります
GLuint red=0,green=511,blue=511,alpha=3;
GLuint val = 0;
val = val | (alpha << 30);
val = val | (blue << 20);
val = val | (green << 10);
val = val | (red << 0);
GLfloat vertices[]={-0.9f, -0.9f, 0.0f,1.0f,
-0.9f, 0.6f, 0.0f,1.0f,
0.6f,0.6f,0.0f,1.0f,
0.6f,-0.9f,0.0f,1.0f};
GLuint test_data[]={val,val,val,val};
glGenBuffers(1, &BufferId);
glBindBuffer(GL_ARRAY_BUFFER, BufferId);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(glGetAttribLocation(shader_data.psId,"position"));
glVertexAttribPointer(glGetAttribLocation(shader_data.psId,"position"),4,GL_FLOAT,GL_FALSE, 0,0);
glGenBuffers(1, &BufferId1);
glBindBuffer(GL_ARRAY_BUFFER, BufferId1);
glBufferData(GL_ARRAY_BUFFER, sizeof(test_data), test_data, GL_STATIC_DRAW);
glEnableVertexAttribArray(glGetAttribLocation(shader_data.psId,"color"));
//glVertexAttribPointer(glGetAttribLocation(shader_data.psId,"color"), 4,GL_INT_2_10_10_10_REV,GL_TRUE, 0,0);
glVertexAttribP4uiv(glGetAttribLocation(shader_data.psId,"color"),GL_UNSIGNED_INT_2_10_10_10_REV ,GL_TRUE,0);
glDrawArrays(GL_TRIANGLE_FAN,0,4);
glDraw 呼び出しでアクセス違反が発生します。コードは glVertexAttribPointer で正常に動作します。ここで何が欠けていますか?