Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'minimalRender' function #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Graphics/DrawingCombinators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module Graphics.DrawingCombinators
(
module Graphics.DrawingCombinators.Affine
-- * Basic types
, Image, render, clearRender
, Image, render, minimalRender, clearRender
-- * Selection
, sample
-- * Geometry
Expand Down Expand Up @@ -135,8 +135,6 @@ instance (Monoid m) => Monoid (Image m) where
-- lower left and (1,1) in the upper right).
render :: Image a -> IO ()
render d = GL.preservingAttrib [GL.AllServerAttributes] $ do
GL.blend GL.$= GL.Enabled
GL.blendFunc GL.$= (GL.SrcAlpha, GL.OneMinusSrcAlpha)
-- For now we assume the user wants antialiasing; the general solution is not clear - maybe let the
-- user do the opengl setup stuff himself? otherwise need to wrap all of the possible things GL lets
-- you set.
Expand All @@ -145,6 +143,14 @@ render d = GL.preservingAttrib [GL.AllServerAttributes] $ do
GL.lineWidth GL.$= 1.5
GL.hint GL.LineSmooth GL.$= GL.DontCare

minimalRender d

-- |Like 'render', but does not do any setup for antialiasing.
minimalRender :: Image a -> IO ()
minimalRender d = GL.preservingAttrib [GL.AllServerAttributes] $ do
GL.blend GL.$= GL.Enabled
GL.blendFunc GL.$= (GL.SrcAlpha, GL.OneMinusSrcAlpha)

dRender d identity white

-- |Like 'render', but clears the screen first. This is so
Expand Down