0
我想從glEvalCoord中讀取值,但沒有得到我應該得到的確切值。我的代碼是glEvalCoord與glFeedback一起使用時沒有按預期輸出
GLfloat ctrlpoints[4][3] = {
{ -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0},
{ 2.0, -4.0, 0.0}, { 4.0, 4.0, 0.0}};
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_LIGHTING);
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]);
glEnable(GL_MAP1_VERTEX_3);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
GLint size;
GLfloat feedBuffer[1024];
glFeedbackBuffer (1024, GL_3D, feedBuffer);
glRenderMode (GL_FEEDBACK);
glBegin (GL_POINTS);
for (int i=0; i<=30; ++i)
{
GLfloat t = GLfloat(i)/30;
glEvalCoord1f(t);
}
glEnd();
size = glRenderMode (GL_RENDER);
cerr<<size<<endl;
}
現在,我不知道,但它不應該給我30個* 3值爲每個曲線的x,y和z座標?但我只獲得7 * 3的值。尺寸輸出爲28.
好吧,明白了。謝謝 – pcoder