Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » openGL custom blendmodes

Credits go to Bob for helping out!
This thread is locked; no one can reply to it. rss feed Print
openGL custom blendmodes
fuzinavl
Member #4,105
December 2003
avatar

Is there a way to define a blendmode which will combine these 2 operations?

  Rgba color(1.0f,1.0f,1.0f,opacity);           
                                     
  Canvas::SetTo( *los_buffer );

  Canvas::SetPixelWriteMode( COLOR_ONLY );  
  Blenders::Set( ADDITIVE_BLENDER );  
  ol::Ellipse( x,y,radius,radius).DrawArc( color, angle + arc/2, arc,0.0,0.0);
  
  Canvas::SetPixelWriteMode( ALPHA_ONLY );  
  glBlendFunc(GL_ZERO,GL_SRC_COLOR); //multiplicative_blender
  ol::Ellipse( x,y,radius,radius).DrawArc( color, angle + arc/2, arc,0.0,0.0);
  
  Canvas::SetPixelWriteMode( COLOR_AND_ALPHA );  //restore default mode

I want to additively combine RGB components, and multiplicatively combine alpha components.
I looked in the openGL redbook, but the predefined enumerations can't do what I need.

__________________________
fuzinavl@hotmail.com (Pittsburgh)
__http://fuzinavl.tripod.com/__

Bob
Free Market Evangelist
September 2000
avatar

Quote:

I want to additively combine RGB components, and multiplicatively combine alpha components.

See EXT_blend_func_separate or OpenGL 1.4.

--
- Bob
[ -- All my signature links are 404 -- ]

fuzinavl
Member #4,105
December 2003
avatar

Thanks!

__________________________
fuzinavl@hotmail.com (Pittsburgh)
__http://fuzinavl.tripod.com/__

Go to: