Simple Color Picker with glReadPixel
I'm trying to read the pixel at the user's cursor when they right click on a triangular gradient, but glReadPixel is only returning black. If I make it a flat color instead of a gradient, it works, so I don't know what's wrong.
I have lighting and depth_test disabled. I'm using GL_Blend for the shade model and changing it to GL_Flat doesn't fix it. I also tried both glReadBuffer(GL_Front) and glReadBuffer(GL_Back). This project is using SDL_GL but I doubt that's the problem since flat colors get picked just fine.
glColor3f(1.0f, 0.0f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glColor3f(0.0f, 0.0f, 1.0f);
glColor3f(1.0f, 1.0f, 1.0f);
//This next part only happens when they right click, but I removed that stuff for now for simplicity. This happens right after the triangle is drawn, though
glReadPixels(mPos, cheight - mPos, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);