aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Sunet <jeannekamikaze@gmail.com>2012-08-31 12:03:07 +0200
committerMarc Sunet <jeannekamikaze@gmail.com>2012-08-31 12:03:07 +0200
commite752f4a4ac90682e46d0889dfb946aa37fb9de7d (patch)
treebc5a1fbee7dd2ed00dc719b85dc1c58f0272252a
parentf3ed8e46d5913806cd8873df678bcd3362e98c93 (diff)
Enhanced docs; added nullPtr to export list
-rw-r--r--Spear/GLSL.hs32
1 files changed, 26 insertions, 6 deletions
diff --git a/Spear/GLSL.hs b/Spear/GLSL.hs
index b64c22e..a2019b0 100644
--- a/Spear/GLSL.hs
+++ b/Spear/GLSL.hs
@@ -1,8 +1,7 @@
1module Spear.GLSL 1module Spear.GLSL
2( 2(
3 module Graphics.Rendering.OpenGL.Raw.Core31
4 -- * General Management 3 -- * General Management
5, GLSLShader 4 GLSLShader
6, GLSLProgram 5, GLSLProgram
7, ShaderType(..) 6, ShaderType(..)
8 -- ** Programs 7 -- ** Programs
@@ -83,6 +82,10 @@ module Spear.GLSL
83, getGLError 82, getGLError
84, printGLError 83, printGLError
85, assertGL 84, assertGL
85 -- * OpenGL
86, module Graphics.Rendering.OpenGL.Raw.Core31
87, Ptr
88, nullPtr
86) 89)
87where 90where
88 91
@@ -476,23 +479,40 @@ bindVAO = glBindVertexArray . getVAO
476-- | Enable the given vertex attribute of the bound vao. 479-- | Enable the given vertex attribute of the bound vao.
477-- 480--
478-- See also 'bindVAO'. 481-- See also 'bindVAO'.
479enableVAOAttrib :: GLuint -> IO () 482enableVAOAttrib :: GLuint -- ^ Attribute index.
483 -> IO ()
480enableVAOAttrib = glEnableVertexAttribArray 484enableVAOAttrib = glEnableVertexAttribArray
481 485
482 486
483-- | Bind the bound buffer to the given point. 487-- | Bind the bound buffer to the given point.
484attribVAOPointer :: GLuint -> GLint -> GLenum -> Bool -> GLsizei -> Int -> IO () 488attribVAOPointer
489 :: GLuint -- ^ The index of the generic vertex attribute to be modified.
490 -> GLint -- ^ The number of components per generic vertex attribute. Must be 1,2,3,4.
491 -> GLenum -- ^ The type of each component in the array.
492 -> Bool -- ^ Whether fixed-point data values should be normalized.
493 -> GLsizei -- ^ Stride. Byte offset between consecutive generic vertex attributes.
494 -> Int -- ^ Offset to the first component in the array.
495 -> IO ()
485attribVAOPointer idx ncomp dattype normalise stride off = 496attribVAOPointer idx ncomp dattype normalise stride off =
486 glVertexAttribPointer idx ncomp dattype (unsafeCoerce normalise) stride (unsafeCoerce off) 497 glVertexAttribPointer idx ncomp dattype (unsafeCoerce normalise) stride (unsafeCoerce off)
487 498
488 499
489-- | Draw the bound vao. 500-- | Draw the bound vao.
490drawArrays :: GLenum -> Int -> Int -> IO () 501drawArrays
502 :: GLenum -- ^ The kind of primitives to render.
503 -> Int -- ^ Starting index in the enabled arrays.
504 -> Int -- ^ The number of indices to be rendered.
505 -> IO ()
491drawArrays mode first count = glDrawArrays mode (unsafeCoerce first) (unsafeCoerce count) 506drawArrays mode first count = glDrawArrays mode (unsafeCoerce first) (unsafeCoerce count)
492 507
493 508
494-- | Draw the bound vao, indexed mode. 509-- | Draw the bound vao, indexed mode.
495drawElements :: GLenum -> Int -> GLenum -> Ptr a -> IO () 510drawElements
511 :: GLenum -- ^ The kind of primitives to render.
512 -> Int -- ^ The number of elements to be rendered.
513 -> GLenum -- ^ The type of the index values. Must be one of gl_UNSIGNED_BYTE, gl_UNSIGNED_SHORT, or gl_UNSIGNED_INT.
514 -> Ptr a -- ^ Pointer to the location where indices are stored, or offset into the index array when there is a bound ElementArrayBuffer.
515 -> IO ()
496drawElements mode count t idxs = glDrawElements mode (unsafeCoerce count) t idxs 516drawElements mode count t idxs = glDrawElements mode (unsafeCoerce count) t idxs
497 517
498 518