我不知道简单代码有什么问题。该函数用于python和ctypes。在
extern "C" void add_lines(bool antialias,GLdouble coordinates[][2],int array_size,GLdouble w,GLdouble r,GLdouble g, GLdouble b,GLdouble a){
glDisable(GL_TEXTURE_2D);
if (antialias){
glEnable(GL_LINE_SMOOTH); //Enable line smoothing.
}
glColor4d(r,g,b,a);
glLineWidth(w);
glBegin(GL_LINE_STRIP);
for (int x = 0; x < array_size; x++) {
glVertex2d(coordinates[x][0],coordinates[x][1]);
}
glEnd();
std::cout << glGetError();
if (antialias){
glDisable(GL_LINE_SMOOTH); //Disable line smoothing.
}
glEnable(GL_TEXTURE_2D);
}
std::cout<;<;glGetError();每次给出1281。在
谢谢。在
你确定这个错误不是在格伦之前触发的吗?glGetError将报告最后一个GL错误,这可能是在程序执行之前导致的。在
^{} 是粘性的:一旦某个函数设置了错误,它将保持在该错误值,直到您调用
glGetError()
。所以,这个错误很可能是其他地方造成的。检查函数项上的glGetError()
的值,然后在每次函数调用之后,找出它的设置位置。在相关问题 更多 >
编程相关推荐