I have no idea what is wrong with the simple code. The function is for use with python and 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(); gives out 1281 each time.
Thankyou.
glGetError()is sticky: once the error gets set by some function, it will stay at that error value until you callglGetError(). So, the error is likely being caused elsewhere. Check the value ofglGetError()on function entry, and then after each function call to find out where it’s being set.