Search code examples
xcodeopenglosx-snow-leopard

glColor3i only drawing black


Why does this only draw black?

 glPushMatrix();
 // Check the current color
 glColor3i(255, 0, 255);
 GLint currentColor[4];
 glGetIntegerv(GL_CURRENT_COLOR, currentColor);
 //currentColor[0] = 254, 1 = 0, 2 = 254, 3 = doesn't matter

 glBegin(GL_QUADS);
 glLineWidth(1);
  glVertex2f(0, 0);
  glVertex2f(WINDOW_WIDTH * .1, 0);
  glVertex2f(WINDOW_WIDTH * .1, WINDOW_HEIGHT);
  glVertex2f(0, WINDOW_HEIGHT);
 glEnd();
 glPopMatrix();

Solution

  • From memory, I think that glColor3i uses colour values that are scaled to cover the full integer range. Hence your 255 values are approximately equal to zero.....

    Try 2147483647 instead.