[HOpenGL] GL_BLEND

Sven Panne Sven.Panne at aedion.de
Sun Oct 10 13:51:25 EDT 2004


Yann Morvan wrote:
> I am not completely sure, but it looks like the binding groups
> the enabling of basic blending and the specification of extended blending
> equations together.
> So that if you wanted to enable blending, you would do
> 
> blendEquation $= Just FuncAdd
> 
> and calling
> 
> blendEquation $= Nothing
> 
> to disable it.

Yep, that's correct. If setting part of the OpenGL state is cheap (like
glBlendEquation), the Haskell binding combines this with the corresponding
glEnable/glDisable call using the Maybe type. This is much cleaner IMHO
and normally doesn't have any measurable performance impact. If it does,
you should better take some care to minimize state changes, anyway... :-)

There are a lot of other examples of these "cheap" changes, e.g. in:

    http://haskell.org/HOpenGL/newAPI/OpenGL/Graphics.Rendering.OpenGL.GL.PerFragment.html

Color tables, OTOH, are not so cheap to change, so

    http://haskell.org/HOpenGL/newAPI/OpenGL/Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable.html

contains a separate state variable to control them (colorTableStage). Further
examples for this kind of state are e.g. textures or convolution filters.

Someday I will document all this stuff... :-]

Cheers,
    S.


More information about the HOpenGL mailing list