OpenGL Colour Interpolation
- by Will-of-fortune
I'm currently working on an little project in C++ and OpenGL and am trying to implement a colour selection tool similar to that in photoshop, as below.
However I am having trouble with interpolation of the large square.
Working on my desktop computer with a 8800 GTS the result was similar but the blending wasn't as smooth.
This is the code I am using:
GLfloat swatch[] = { 0,0,0, 1,1,1, mR,mG,mB, 0,0,0 };
GLint swatchVert[] = { 400,700, 400,500, 600,500, 600,700 };
glVertexPointer(2, GL_INT, 0, swatchVert);
glColorPointer(3, GL_FLOAT, 0, swatch);
glDrawArrays(GL_QUADS, 0, 4);
Moving onto my laptop with Intel Graphics HD 3000, this result was even worse with no change in code.
I thought it was OpenGL splitting the quad into two triangles, so I tried rendering using triangles and interpolating the colour in the middle of the square myself but it still doesnt quite match the result I was hoping for.
Any help would be appreciated.
Thanks.