I have a program with a function that sets the color to draw with a color taken from an original Point source. I want the function to set the color so that the opacity is changed depending on the given alpha value. I’m not sure what I’m doing wrong because when I run my program the opacity of the colors doesn’t change. Any ideas?
void ImpBrush::SetColor (const Point source)
{
ImpressionistDoc* pDoc = GetDocument();
float alpha = pDoc->getAlpha(); // gets the specified alpha value
GLubyte ubyte = static_cast<GLubyte>(alpha * 255.f); // converts the alpha value to a GLubyte
GLubyte color[4]; // array to hold the RGBA values
memcpy ( color, pDoc->GetOriginalPixel( source ), 3 ); // copies the RGB values from the original Point into the array
color[3] = ubyte; // sets the last element in the array to the alpha GLubyte value
glEnable (GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4ubv( color );
}