PDA

View Full Version : GL_DST_ALPHA blending different under Mac vs Win



JoshB
08-11-2011, 01:13 PM
Hello All,

Pertaining to the same project as my last post, that being the crossplatform (Mac/Win) visualization of a timeline of a NonLinear Editor (a la Final Cut Pro or Premiere Pro) using OpenGL, I have run into another issue.

Short version:
In crossplatform code that works exactly as expected on Mac (OS 10.6.6 - GeForce 8600M GT), when run on Windows (Vista-64 - Quadro 4800) I can't seem to get blending to work with a call to glBlendFunc() as follows: glBlendFunc(GL_DST_ALPHA, GL_ZERO). Is there any setting / initialization that needs to explicitly occur to get such alpha blending working on Windows, which is setup properly by default on Mac?

Longer Version:
The spec for this project calls for the entries of the timeline to be rounded rectangles that are bicolored, in that the top 2/3 of the round rect is one color (actually a gradient) and the bottom 1/3 is another color (a different gradient). To perform overall drawing, I am attempting the following:
1) clear to (0.0, 0.0, 0.0, 0.0) the color, depth and accum buffers
2) using either a draw color of (0.0, 0.0, 0.0, 1.0) or (1.0, 1.0, 1.0, 1.0) I iteratively jitter and draw into the accumulation buffer a rounded-rect alpha channel view of each of my entries - doing so to perform scene antialiasing on what will be the alpha mask for the color representations of the entries
3) pull this antialiased 'scene-wide' alpha mask out into my draw buffer
4) set the blend func to glBlendFunc(GL_DST_ALPHA, GL_ZERO) and draw the square views of the entries in the same position as the rounded rects views, expecting the blend func to perform the desired blending and make my square color rects rounded via the round rect alpha

No matter what I have tried, on Windows I can't get this to work; the render always comes out showing square rects - it is as if either every pixel within (or transferred from) the accum buffer somehow winds up with an alpha of 1.0 OR the GL_DST_ALPHA blend func doesn't work properly, as-is. However, as mentioned in the Short Version: the self-same code works perfectly fine on the Mac and produces the smooth-looking bi-colored round rects I am expecting. From the info I have supplied is there something glaring that I am missing (note that for these early, quick tests I am using GLUT for the purpose of windowing)? I can supply more info or code examples if anyone is inclined to help me dig further into this.

Thanks again in advance,
Josh

JoshB
08-11-2011, 01:26 PM
Ooops. It was GLUT, on Windows GLUT_ALPHA must be explicitly supplied to glutInitDisplayMode() whereas on Mac this is not necessary.