diff options
| -rw-r--r-- | Spear/GLSL.hs | 32 |
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 @@ | |||
| 1 | module Spear.GLSL | 1 | module 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 | ) |
| 87 | where | 90 | where |
| 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'. |
| 479 | enableVAOAttrib :: GLuint -> IO () | 482 | enableVAOAttrib :: GLuint -- ^ Attribute index. |
| 483 | -> IO () | ||
| 480 | enableVAOAttrib = glEnableVertexAttribArray | 484 | enableVAOAttrib = glEnableVertexAttribArray |
| 481 | 485 | ||
| 482 | 486 | ||
| 483 | -- | Bind the bound buffer to the given point. | 487 | -- | Bind the bound buffer to the given point. |
| 484 | attribVAOPointer :: GLuint -> GLint -> GLenum -> Bool -> GLsizei -> Int -> IO () | 488 | attribVAOPointer |
| 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 () | ||
| 485 | attribVAOPointer idx ncomp dattype normalise stride off = | 496 | attribVAOPointer 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. |
| 490 | drawArrays :: GLenum -> Int -> Int -> IO () | 501 | drawArrays |
| 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 () | ||
| 491 | drawArrays mode first count = glDrawArrays mode (unsafeCoerce first) (unsafeCoerce count) | 506 | drawArrays 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. |
| 495 | drawElements :: GLenum -> Int -> GLenum -> Ptr a -> IO () | 510 | drawElements |
| 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 () | ||
| 496 | drawElements mode count t idxs = glDrawElements mode (unsafeCoerce count) t idxs | 516 | drawElements mode count t idxs = glDrawElements mode (unsafeCoerce count) t idxs |
| 497 | 517 | ||
| 498 | 518 | ||
