Safe Haskell | None |
---|---|
Language | Haskell2010 |
Rendering things.
- draw :: (MonadIO m, MonadMask m) => DrawCommand -> DrawParams -> m ()
- runDraws :: (MonadIO m, MonadMask m) => DrawParams -> DrawT m a -> m a
- data DrawT m a
- type Draw = DrawT IO
- drawR :: (MonadIO m, MonadMask m) => DrawCommand -> DrawT m ()
- setBlending :: MonadIO m => BlendSpec -> DrawT m ()
- setFragmentPassTests :: MonadIO m => FragmentPassTests -> DrawT m ()
- setPipeline :: MonadIO m => Pipeline -> DrawT m ()
- setPolygonOffset :: MonadIO m => Float -> Float -> DrawT m ()
- setPrimitiveRestart :: MonadIO m => Maybe Word32 -> DrawT m ()
- setTargetFramebuffer :: MonadIO m => Framebuffer -> DrawT m ()
- setTextureBindings :: MonadIO m => IntMap Texture -> DrawT m ()
- data DrawCommand = DrawCommand {}
- drawCommand :: DrawCommand
- data DrawParams = DrawParams {}
- defaultDrawParams :: DrawParams
- data SourceData
- = Primitives {
- firstIndex :: Int
- | PrimitivesWithIndices { }
- = Primitives {
- data IndexType
- data Primitive
- class IndexTypeable a where
- toIndexType :: a -> IndexType
- data FragmentPassTests = FragmentPassTests {}
- defaultFragmentPassTests :: FragmentPassTests
- data ComparisonFunc
- data StencilOp
- data Culling
- = Back
- | Front
- | FrontAndBack
- | NoCulling
The drawing functions
draw :: (MonadIO m, MonadMask m) => DrawCommand -> DrawParams -> m () Source
Draws according to a DrawCommand
.
There is a very large overhead in doing a single draw
call. You probably
want to use runDraws
and drawR
instead.
:: (MonadIO m, MonadMask m) | |
=> DrawParams | Initial drawing parameters. These can be
changed in the |
-> DrawT m a | Draw command stream. |
-> m a |
Runs a drawing specification.
You can think of this as running many draw
commands with similar draw
command specifications. This call is an optimization to draw
which has a
high overhead by itself.
Another way to think of this is a place where the functional, "no hidden
state" design of the Caramia API is relaxed inside the Draw
stream.
Draw command stream
MonadTrans DrawT | |
Monad m => Monad (DrawT m) | |
Functor m => Functor (DrawT m) | |
(Monad m, Functor m) => Applicative (DrawT m) | |
MonadIO m => MonadIO (DrawT m) | Using One useful thing to do is to set uniforms to pipelines with |
Typeable ((* -> *) -> * -> *) DrawT |
setBlending :: MonadIO m => BlendSpec -> DrawT m () Source
Changes the current blending mode.
setFragmentPassTests :: MonadIO m => FragmentPassTests -> DrawT m () Source
Sets the new fragment pass tests.
setPipeline :: MonadIO m => Pipeline -> DrawT m () Source
Changes the pipeline in a Draw
command stream.
setPrimitiveRestart :: MonadIO m => Maybe Word32 -> DrawT m () Source
Sets new primitive restart mode.
setTargetFramebuffer :: MonadIO m => Framebuffer -> DrawT m () Source
Sets the current framebuffer.
Specifying what to draw
data DrawCommand Source
Contains a specification of what to draw.
It is recommended to use drawCommand
instead of this constructor.
DrawCommand | |
|
drawCommand :: DrawCommand Source
Returns a default draw command.
Several fields are undefined so you must set them. These are
numInstances
is set to 1. In future (minor) versions if we add any new
fields those fields will have a sane default value.
data DrawParams Source
Contains drawing parameters.
You can use defaultDrawParams
to obtain default draw parameters.
DrawParams | |
|
defaultDrawParams :: DrawParams Source
Default drawing parameters.
pipeline
is not set (that is, it's undefined). You must set it.
No textures are bound.
Blending mode is premultiplied alpha.
No primitive restart is used.
targetFramebuffer
is the screen framebuffer.
data SourceData Source
Values of this type tell how to select attribute data from
primitivesVAO
.
Future minor versions will not add any new fields or remove any fields from these values. Instead, new constructors are introduced.
Primitives | Simply start from some index and continue from there, 0, 1, 2, etc. OpenGL equivalent is |
| |
PrimitivesWithIndices | Use an index buffer. OpenGL equivalent is |
|
The type of indices in an index buffer. See indexBuffer
.
The different types of primitives you can use for rendering.
class IndexTypeable a where Source
Fragment pass tests
data FragmentPassTests Source
Specifies the tests that are run on a fragment to decide if it should be seen.
FragmentPassTests | |
|
defaultFragmentPassTests :: FragmentPassTests Source
Returns the default fragment pass tests.
Neither depth or stencil test is enabled. writeDepth
is set to true but
that value is only used if you specify with depth test to use.
All stencil operations are set to Keep
.
Culling is set to Back
.
data ComparisonFunc Source
A comparison function. Incoming value is compared with this function to the existing value.
This can be used with depth and stencil tests.
See glDepthFunc
from OpenGL specification or man pages for more detailed
explanation.
Stencil buffer operations.
See glStencilOp
for explanations of each constructor.
Keep | |
Zero | |
Replace | This one replaces the old value in the stencil buffer with the given reference value and ANDs the result with mask. |
Increment | |
IncrementAndWrap | |
Decrease | |
DecreaseAndWrap | |
Invert |