OpenGL 2.11.1.0 → 3.0.3.0
raw patch · 123 files changed
Files
- CHANGELOG.md +62/−0
- OpenGL.cabal +25/−6
- README.md +4/−1
- src/Graphics/Rendering/OpenGL.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL.hs +7/−7
- src/Graphics/Rendering/OpenGL/GL/Antialiasing.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/BeginEnd.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Bitmaps.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/BlendingFactor.hs +32/−32
- src/Graphics/Rendering/OpenGL/GL/BufferMode.hs +31/−28
- src/Graphics/Rendering/OpenGL/GL/BufferObjects.hs +66/−62
- src/Graphics/Rendering/OpenGL/GL/ByteString.hs +12/−4
- src/Graphics/Rendering/OpenGL/GL/Capability.hs +98/−98
- src/Graphics/Rendering/OpenGL/GL/Clipping.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/ColorSum.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/Colors.hs +55/−55
- src/Graphics/Rendering/OpenGL/GL/ComparisonFunction.hs +18/−18
- src/Graphics/Rendering/OpenGL/GL/ConditionalRendering.hs +6/−6
- src/Graphics/Rendering/OpenGL/GL/ControlPoint.hs +20/−20
- src/Graphics/Rendering/OpenGL/GL/CoordTrans.hs +29/−63
- src/Graphics/Rendering/OpenGL/GL/DataType.hs +82/−91
- src/Graphics/Rendering/OpenGL/GL/DebugOutput.hs +95/−51
- src/Graphics/Rendering/OpenGL/GL/DisplayLists.hs +20/−13
- src/Graphics/Rendering/OpenGL/GL/Domain.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/EdgeFlag.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/Evaluators.hs +8/−8
- src/Graphics/Rendering/OpenGL/GL/Exception.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/Face.hs +8/−8
- src/Graphics/Rendering/OpenGL/GL/Feedback.hs +16/−16
- src/Graphics/Rendering/OpenGL/GL/FlushFinish.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/Fog.hs +27/−27
- src/Graphics/Rendering/OpenGL/GL/Framebuffer.hs +266/−138
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/Attachments.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObject.hs +16/−9
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObjectAttachment.hs +15/−15
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObjects.hs +10/−10
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferTarget.hs +6/−6
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/Queries.hs +30/−30
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferObject.hs +16/−8
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferObjects.hs +3/−4
- src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferTarget.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/GLboolean.hs +5/−5
- src/Graphics/Rendering/OpenGL/GL/Hints.hs +18/−18
- src/Graphics/Rendering/OpenGL/GL/IOState.hs +7/−1
- src/Graphics/Rendering/OpenGL/GL/LineSegments.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/MatrixComponent.hs +61/−0
- src/Graphics/Rendering/OpenGL/GL/ObjectName.hs +0/−75
- src/Graphics/Rendering/OpenGL/GL/PeekPoke.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/PerFragment.hs +104/−79
- src/Graphics/Rendering/OpenGL/GL/PixelData.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/PixelFormat.hs +66/−66
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/ColorTable.hs +30/−30
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Convolution.hs +21/−21
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Histogram.hs +13/−13
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Minmax.hs +6/−6
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelMap.hs +13/−13
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelStorage.hs +19/−19
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelTransfer.hs +33/−33
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Rasterization.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Reset.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Sink.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/PixellikeObject.hs +21/−21
- src/Graphics/Rendering/OpenGL/GL/PointParameter.hs +6/−6
- src/Graphics/Rendering/OpenGL/GL/Points.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/PolygonMode.hs +8/−8
- src/Graphics/Rendering/OpenGL/GL/Polygons.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/PrimitiveMode.hs +40/−8
- src/Graphics/Rendering/OpenGL/GL/PrimitiveModeInternal.hs +24/−24
- src/Graphics/Rendering/OpenGL/GL/QueryObject.hs +13/−7
- src/Graphics/Rendering/OpenGL/GL/QueryObjects.hs +14/−14
- src/Graphics/Rendering/OpenGL/GL/QueryUtils.hs +52/−11
- src/Graphics/Rendering/OpenGL/GL/QueryUtils/PName.hs +385/−357
- src/Graphics/Rendering/OpenGL/GL/QueryUtils/VertexAttrib.hs +11/−11
- src/Graphics/Rendering/OpenGL/GL/RasterPos.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/ReadCopyPixels.hs +9/−9
- src/Graphics/Rendering/OpenGL/GL/Rectangles.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/RenderMode.hs +9/−9
- src/Graphics/Rendering/OpenGL/GL/SavingState.hs +27/−27
- src/Graphics/Rendering/OpenGL/GL/Selection.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Shaders.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/Shaders/Attribs.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Shaders/Limits.hs +4/−10
- src/Graphics/Rendering/OpenGL/GL/Shaders/Program.hs +42/−36
- src/Graphics/Rendering/OpenGL/GL/Shaders/ProgramBinaries.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Shaders/ProgramObjects.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Shaders/Shader.hs +11/−5
- src/Graphics/Rendering/OpenGL/GL/Shaders/ShaderBinaries.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Shaders/ShaderObjects.hs +26/−26
- src/Graphics/Rendering/OpenGL/GL/Shaders/Uniform.hs +90/−20
- src/Graphics/Rendering/OpenGL/GL/Shaders/Variables.hs +53/−53
- src/Graphics/Rendering/OpenGL/GL/StateVar.hs +0/−160
- src/Graphics/Rendering/OpenGL/GL/StringQueries.hs +52/−25
- src/Graphics/Rendering/OpenGL/GL/SyncObjects.hs +23/−18
- src/Graphics/Rendering/OpenGL/GL/Tensor.hs +6/−3
- src/Graphics/Rendering/OpenGL/GL/Texturing.hs +1/−1
- src/Graphics/Rendering/OpenGL/GL/Texturing/Application.hs +2/−2
- src/Graphics/Rendering/OpenGL/GL/Texturing/Environments.hs +69/−68
- src/Graphics/Rendering/OpenGL/GL/Texturing/Filter.hs +14/−14
- src/Graphics/Rendering/OpenGL/GL/Texturing/Objects.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Texturing/Parameters.hs +29/−31
- src/Graphics/Rendering/OpenGL/GL/Texturing/PixelInternalFormat.hs +274/−217
- src/Graphics/Rendering/OpenGL/GL/Texturing/Queries.hs +58/−20
- src/Graphics/Rendering/OpenGL/GL/Texturing/Specification.hs +3/−3
- src/Graphics/Rendering/OpenGL/GL/Texturing/TexParameter.hs +24/−24
- src/Graphics/Rendering/OpenGL/GL/Texturing/TextureObject.hs +13/−7
- src/Graphics/Rendering/OpenGL/GL/Texturing/TextureTarget.hs +35/−35
- src/Graphics/Rendering/OpenGL/GL/Texturing/TextureUnit.hs +4/−4
- src/Graphics/Rendering/OpenGL/GL/TransformFeedback.hs +10/−7
- src/Graphics/Rendering/OpenGL/GL/VertexArrayObjects.hs +14/−9
- src/Graphics/Rendering/OpenGL/GL/VertexArrays.hs +85/−45
- src/Graphics/Rendering/OpenGL/GL/VertexAttributes.hs +5/−3
- src/Graphics/Rendering/OpenGL/GL/VertexSpec.hs +3/−3
- src/Graphics/Rendering/OpenGL/GLU.hs +1/−1
- src/Graphics/Rendering/OpenGL/GLU/Errors.hs +2/−2
- src/Graphics/Rendering/OpenGL/GLU/ErrorsInternal.hs +135/−71
- src/Graphics/Rendering/OpenGL/GLU/Initialization.hs +8/−11
- src/Graphics/Rendering/OpenGL/GLU/Matrix.hs +3/−3
- src/Graphics/Rendering/OpenGL/GLU/Mipmapping.hs +3/−3
- src/Graphics/Rendering/OpenGL/GLU/NURBS.hs +32/−32
- src/Graphics/Rendering/OpenGL/GLU/Quadrics.hs +13/−13
- src/Graphics/Rendering/OpenGL/GLU/Tessellation.hs +17/−17
+ CHANGELOG.md view
@@ -0,0 +1,62 @@+3.0.3.0+-------+* Handle MonadFail proposal.++3.0.2.2+-------+* Relaxed upper version bound for `containers`.++3.0.2.1+-------+* Relaxed upper version bound for `OpenGLRaw`.++3.0.2.0+-------+* Added support for S3_s3tc, EXT_texture_compression_s3tc, ARB_texture_float, and EXT_packed_depth_stencil extensions.++3.0.1.0+-------+* Added `Uniform` instances for `GLmatrix`, `Vertex1`, `Vector1`, `Vector2`, `Vector3`, and `Vector4`.+* Unbreak `Uniform` instances for `GLint`, `GLuint` and `Gldouble`.+* Relaxed upper version bound for `OpenGLRaw`.++3.0.0.2+-------+* Removed redundant constraints.++3.0.0.1+-------+* Relaxed upper version bound for `OpenGLRaw`.++3.0.0.0+-------+* Depend on new `OpenGLRaw` and `GLURaw` packages.++2.13.2.1+--------+* Relaxed upper version bound for `transformers`.++2.13.2.0+--------+* Implement Uniform instances for `GLint`, `GLuint`, `GLfloat`, and `GLdouble`.++2.13.1.1+--------+* Aftermath for the `glClearNamedFramebufferfi` chaos in the OpenGL registry,+ see the corresponding+ [issue](https://www.khronos.org/bugzilla/show_bug.cgi?id=1394) on Khronos.++2.13.1.0+--------+* Added `extensionSupported`.+* Relaxed upper version bound for OpenGLRaw.+* Added CHANGELOG.md to distribution.++2.13.0.0+--------+* Added missing drawing commands using vertex arrays and some related types.+* Added missing whole framebuffer operations.+* Added getters for `stencilMaskSeparate`, `stencilFuncSeparate`, and `stencilOpSeparate`, making them full-blown `StateVar`s.+* Added `patchDefaultInnerLevel` and `patchDefaultOuterLevel` to control the default tessellation levels.+* Added `ContextLost` constructor to `ErrorCategory` type.+* Added `SeparateAttribs` and deprecated `SeperateAttribs`, fixing a spelling mistake.
OpenGL.cabal view
@@ -1,8 +1,8 @@ name: OpenGL-version: 2.11.1.0+version: 3.0.3.0 synopsis: A binding for the OpenGL graphics system description:- A Haskell binding for the OpenGL graphics system (GL, version 4.5) and its+ A Haskell binding for the OpenGL graphics system (GL, version 4.6) and its accompanying utility library (GLU, version 1.3). . OpenGL is the industry's most widely used and supported 2D and 3D graphics@@ -11,16 +11,26 @@ functions. For more information about OpenGL and its various extensions, please see <http://www.opengl.org/> and <http://www.opengl.org/registry/>.-homepage: http://www.haskell.org/haskellwiki/Opengl+homepage: https://wiki.haskell.org/OpenGL bug-reports: https://github.com/haskell-opengl/OpenGL/issues+copyright: Copyright (C) 2002-2019 Sven Panne license: BSD3 license-file: LICENSE author: Sven Panne maintainer: Sven Panne <svenpanne@gmail.com>, Jason Dagit <dagitj@gmail.com> category: Graphics build-type: Simple+tested-with:+ GHC == 7.8.4+ GHC == 7.10.3+ GHC == 8.0.2+ GHC == 8.2.2+ GHC == 8.4.3+ GHC == 8.6.5+ GHC == 8.8.1 cabal-version: >= 1.10 extra-source-files:+ CHANGELOG.md README.md library@@ -50,7 +60,6 @@ Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObjects Graphics.Rendering.OpenGL.GL.Hints Graphics.Rendering.OpenGL.GL.LineSegments- Graphics.Rendering.OpenGL.GL.ObjectName Graphics.Rendering.OpenGL.GL.PerFragment Graphics.Rendering.OpenGL.GL.PixelRectangles Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable@@ -79,7 +88,6 @@ Graphics.Rendering.OpenGL.GL.Shaders.ShaderBinaries Graphics.Rendering.OpenGL.GL.Shaders.ShaderObjects Graphics.Rendering.OpenGL.GL.Shaders.Uniform- Graphics.Rendering.OpenGL.GL.StateVar Graphics.Rendering.OpenGL.GL.StringQueries Graphics.Rendering.OpenGL.GL.SyncObjects Graphics.Rendering.OpenGL.GL.Tensor@@ -121,6 +129,7 @@ Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget Graphics.Rendering.OpenGL.GL.GLboolean Graphics.Rendering.OpenGL.GL.IOState+ Graphics.Rendering.OpenGL.GL.MatrixComponent Graphics.Rendering.OpenGL.GL.PeekPoke Graphics.Rendering.OpenGL.GL.PixelData Graphics.Rendering.OpenGL.GL.PixelFormat@@ -147,8 +156,18 @@ Graphics.Rendering.OpenGL.GLU.ErrorsInternal hs-source-dirs: src ghc-options: -Wall+ if impl(ghc > 8)+ ghc-options: -Wcompat build-depends:- base >= 3 && < 5, bytestring, text, OpenGLRaw >= 2.1, GLURaw >= 1.3.0.0+ base >= 3 && < 5,+ bytestring >= 0.9 && < 0.11,+ containers >= 0.3 && < 0.7,+ text >= 0.1 && < 1.3,+ transformers >= 0.2 && < 0.6,+ ObjectName >= 1.1 && < 1.2,+ StateVar >= 1.1 && < 1.2,+ OpenGLRaw >= 3.0 && < 3.4,+ GLURaw >= 2.0 && < 2.1 default-language: Haskell2010 other-extensions: CPP
README.md view
@@ -1,1 +1,4 @@-[](https://hackage.haskell.org/package/OpenGL) [](https://travis-ci.org/haskell-opengl/OpenGL)+[](https://hackage.haskell.org/package/OpenGL)+[](https://www.stackage.org/lts/package/OpenGL)+[](https://www.stackage.org/nightly/package/OpenGL)+[](https://travis-ci.org/haskell-opengl/OpenGL)
src/Graphics/Rendering/OpenGL.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,9 +15,9 @@ module Graphics.Rendering.OpenGL.GL ( -- * OpenGL Fundamentals- module Graphics.Rendering.OpenGL.Raw.Types,+ module Graphics.GL.Types, module Graphics.Rendering.OpenGL.GL.FlushFinish,- module Graphics.Rendering.OpenGL.GL.ObjectName,+ module Data.ObjectName, -- * Event Model module Graphics.Rendering.OpenGL.GL.SyncObjects,@@ -68,15 +68,16 @@ module Graphics.Rendering.OpenGL.GL.DebugOutput, -- * State and State Requests- module Graphics.Rendering.OpenGL.GL.StateVar,+ module Data.StateVar, module Graphics.Rendering.OpenGL.GL.Tensor, module Graphics.Rendering.OpenGL.GL.StringQueries, module Graphics.Rendering.OpenGL.GL.SavingState ) where -import Graphics.Rendering.OpenGL.Raw.Types+import Graphics.GL.Types import Graphics.Rendering.OpenGL.GL.FlushFinish-import Graphics.Rendering.OpenGL.GL.ObjectName+import Data.ObjectName+import Data.StateVar import Graphics.Rendering.OpenGL.GL.SyncObjects import Graphics.Rendering.OpenGL.GL.QueryObjects@@ -120,7 +121,6 @@ import Graphics.Rendering.OpenGL.GL.TransformFeedback import Graphics.Rendering.OpenGL.GL.DebugOutput -import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.StringQueries import Graphics.Rendering.OpenGL.GL.SavingState
src/Graphics/Rendering/OpenGL/GL/Antialiasing.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Antialiasing--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,10 +17,10 @@ sampleBuffers, samples, multisample, subpixelBits ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/BeginEnd.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.BeginEnd--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,13 +22,13 @@ edgeFlag ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.EdgeFlag import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.PrimitiveMode import Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Bitmaps.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Bitmaps--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,7 +19,7 @@ import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.Tensor-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/BlendingFactor.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.BlendingFactor--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ BlendingFactor(..), marshalBlendingFactor, unmarshalBlendingFactor ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -41,37 +41,37 @@ marshalBlendingFactor :: BlendingFactor -> GLenum marshalBlendingFactor x = case x of- Zero -> gl_ZERO- One -> gl_ONE- SrcColor -> gl_SRC_COLOR- OneMinusSrcColor -> gl_ONE_MINUS_SRC_COLOR- DstColor -> gl_DST_COLOR- OneMinusDstColor -> gl_ONE_MINUS_DST_COLOR- SrcAlpha -> gl_SRC_ALPHA- OneMinusSrcAlpha -> gl_ONE_MINUS_SRC_ALPHA- DstAlpha -> gl_DST_ALPHA- OneMinusDstAlpha -> gl_ONE_MINUS_DST_ALPHA- ConstantColor -> gl_CONSTANT_COLOR- OneMinusConstantColor -> gl_ONE_MINUS_CONSTANT_COLOR- ConstantAlpha -> gl_CONSTANT_ALPHA- OneMinusConstantAlpha -> gl_ONE_MINUS_CONSTANT_ALPHA- SrcAlphaSaturate -> gl_SRC_ALPHA_SATURATE+ Zero -> GL_ZERO+ One -> GL_ONE+ SrcColor -> GL_SRC_COLOR+ OneMinusSrcColor -> GL_ONE_MINUS_SRC_COLOR+ DstColor -> GL_DST_COLOR+ OneMinusDstColor -> GL_ONE_MINUS_DST_COLOR+ SrcAlpha -> GL_SRC_ALPHA+ OneMinusSrcAlpha -> GL_ONE_MINUS_SRC_ALPHA+ DstAlpha -> GL_DST_ALPHA+ OneMinusDstAlpha -> GL_ONE_MINUS_DST_ALPHA+ ConstantColor -> GL_CONSTANT_COLOR+ OneMinusConstantColor -> GL_ONE_MINUS_CONSTANT_COLOR+ ConstantAlpha -> GL_CONSTANT_ALPHA+ OneMinusConstantAlpha -> GL_ONE_MINUS_CONSTANT_ALPHA+ SrcAlphaSaturate -> GL_SRC_ALPHA_SATURATE unmarshalBlendingFactor :: GLenum -> BlendingFactor unmarshalBlendingFactor x- | x == gl_ZERO = Zero- | x == gl_ONE = One- | x == gl_SRC_COLOR = SrcColor- | x == gl_ONE_MINUS_SRC_COLOR = OneMinusSrcColor- | x == gl_DST_COLOR = DstColor- | x == gl_ONE_MINUS_DST_COLOR = OneMinusDstColor- | x == gl_SRC_ALPHA = SrcAlpha- | x == gl_ONE_MINUS_SRC_ALPHA = OneMinusSrcAlpha- | x == gl_DST_ALPHA = DstAlpha- | x == gl_ONE_MINUS_DST_ALPHA = OneMinusDstAlpha- | x == gl_CONSTANT_COLOR = ConstantColor- | x == gl_ONE_MINUS_CONSTANT_COLOR = OneMinusConstantColor- | x == gl_CONSTANT_ALPHA = ConstantAlpha- | x == gl_ONE_MINUS_CONSTANT_ALPHA = OneMinusConstantAlpha- | x == gl_SRC_ALPHA_SATURATE = SrcAlphaSaturate+ | x == GL_ZERO = Zero+ | x == GL_ONE = One+ | x == GL_SRC_COLOR = SrcColor+ | x == GL_ONE_MINUS_SRC_COLOR = OneMinusSrcColor+ | x == GL_DST_COLOR = DstColor+ | x == GL_ONE_MINUS_DST_COLOR = OneMinusDstColor+ | x == GL_SRC_ALPHA = SrcAlpha+ | x == GL_ONE_MINUS_SRC_ALPHA = OneMinusSrcAlpha+ | x == GL_DST_ALPHA = DstAlpha+ | x == GL_ONE_MINUS_DST_ALPHA = OneMinusDstAlpha+ | x == GL_CONSTANT_COLOR = ConstantColor+ | x == GL_ONE_MINUS_CONSTANT_COLOR = OneMinusConstantColor+ | x == GL_CONSTANT_ALPHA = ConstantAlpha+ | x == GL_ONE_MINUS_CONSTANT_ALPHA = OneMinusConstantAlpha+ | x == GL_SRC_ALPHA_SATURATE = SrcAlphaSaturate | otherwise = error ("unmarshalBlendingFactor: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/BufferMode.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.BufferMode--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,11 +19,14 @@ maxColorAttachments, ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- --- | The set of color buffers which are selected for reading and writing.+-- | The set of color buffers which are selected for reading and writing. Note+-- that 'FBOColorAttachment' can only be used with framebuffer objects, while+-- the rest can only be used with the default framebuffer. Furthermore, OpenGL+-- 3.0 deprecated auxiliary buffers, so avoid 'AuxBuffer' in modern code. data BufferMode = NoBuffers@@ -68,21 +71,21 @@ marshalBufferMode :: BufferMode -> Maybe GLenum marshalBufferMode x = case x of- NoBuffers -> Just gl_NONE- FrontLeftBuffer -> Just gl_FRONT_LEFT- FrontRightBuffer -> Just gl_FRONT_RIGHT- BackLeftBuffer -> Just gl_BACK_LEFT- BackRightBuffer -> Just gl_BACK_RIGHT- FrontBuffers -> Just gl_FRONT- BackBuffers -> Just gl_BACK- LeftBuffers -> Just gl_LEFT- RightBuffers -> Just gl_RIGHT- FrontAndBackBuffers -> Just gl_FRONT_AND_BACK+ NoBuffers -> Just GL_NONE+ FrontLeftBuffer -> Just GL_FRONT_LEFT+ FrontRightBuffer -> Just GL_FRONT_RIGHT+ BackLeftBuffer -> Just GL_BACK_LEFT+ BackRightBuffer -> Just GL_BACK_RIGHT+ FrontBuffers -> Just GL_FRONT+ BackBuffers -> Just GL_BACK+ LeftBuffers -> Just GL_LEFT+ RightBuffers -> Just GL_RIGHT+ FrontAndBackBuffers -> Just GL_FRONT_AND_BACK AuxBuffer i- | fromIntegral i <= maxAuxBuffer -> Just (gl_AUX0 + fromIntegral i)+ | fromIntegral i <= maxAuxBuffer -> Just (GL_AUX0 + fromIntegral i) | otherwise -> Nothing FBOColorAttachment i- | fromIntegral i <= maxColorAttachments -> Just (gl_COLOR_ATTACHMENT0 + fromIntegral i)+ | fromIntegral i <= maxColorAttachments -> Just (GL_COLOR_ATTACHMENT0 + fromIntegral i) | otherwise -> Nothing unmarshalBufferMode :: GLenum -> BufferMode@@ -91,19 +94,19 @@ unmarshalBufferModeSafe :: GLenum -> Maybe BufferMode unmarshalBufferModeSafe x- | x == gl_NONE = Just NoBuffers- | x == gl_FRONT_LEFT = Just FrontLeftBuffer- | x == gl_FRONT_RIGHT = Just FrontRightBuffer- | x == gl_BACK_LEFT = Just BackLeftBuffer- | x == gl_BACK_RIGHT = Just BackRightBuffer- | x == gl_FRONT = Just FrontBuffers- | x == gl_BACK = Just BackBuffers- | x == gl_LEFT = Just LeftBuffers- | x == gl_RIGHT = Just RightBuffers- | x == gl_FRONT_AND_BACK = Just FrontAndBackBuffers- | gl_AUX0 <= x && x <= gl_AUX0 + maxAuxBuffer = Just . AuxBuffer . fromIntegral $ x - gl_AUX0- | gl_COLOR_ATTACHMENT0 <= x && x <= gl_COLOR_ATTACHMENT0 + maxColorAttachments- = Just . FBOColorAttachment . fromIntegral $ x - gl_COLOR_ATTACHMENT0+ | x == GL_NONE = Just NoBuffers+ | x == GL_FRONT_LEFT = Just FrontLeftBuffer+ | x == GL_FRONT_RIGHT = Just FrontRightBuffer+ | x == GL_BACK_LEFT = Just BackLeftBuffer+ | x == GL_BACK_RIGHT = Just BackRightBuffer+ | x == GL_FRONT = Just FrontBuffers+ | x == GL_BACK = Just BackBuffers+ | x == GL_LEFT = Just LeftBuffers+ | x == GL_RIGHT = Just RightBuffers+ | x == GL_FRONT_AND_BACK = Just FrontAndBackBuffers+ | GL_AUX0 <= x && x <= GL_AUX0 + maxAuxBuffer = Just . AuxBuffer . fromIntegral $ x - GL_AUX0+ | GL_COLOR_ATTACHMENT0 <= x && x <= GL_COLOR_ATTACHMENT0 + maxColorAttachments+ = Just . FBOColorAttachment . fromIntegral $ x - GL_COLOR_ATTACHMENT0 | otherwise = Nothing maxAuxBuffer :: GLenum
src/Graphics/Rendering/OpenGL/GL/BufferObjects.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.BufferObjects--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -41,20 +41,21 @@ indexedBufferStart, indexedBufferSize ) where -import Data.Maybe-import Foreign.Marshal.Array-import Foreign.Marshal.Utils-import Foreign.Ptr-import Foreign.Storable+import Control.Monad.IO.Class+import Data.Maybe ( fromMaybe )+import Data.ObjectName+import Data.StateVar+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Foreign.Marshal.Utils ( with )+import Foreign.Ptr ( Ptr, nullPtr )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexArrays import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -64,18 +65,21 @@ -------------------------------------------------------------------------------- instance ObjectName BufferObject where- isObjectName = fmap unmarshalGLboolean . glIsBuffer . bufferID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsBuffer . bufferID deleteObjectNames bufferObjects =- withArrayLen (map bufferID bufferObjects) $+ liftIO . withArrayLen (map bufferID bufferObjects) $ glDeleteBuffers . fromIntegral instance GeneratableObjectName BufferObject where genObjectNames n =- allocaArray n $ \buf -> do+ liftIO . allocaArray n $ \buf -> do glGenBuffers (fromIntegral n) buf fmap (map BufferObject) $ peekArray n buf +instance CanBeLabeled BufferObject where+ objectLabel = objectNameLabel GL_BUFFER . bufferID+ -------------------------------------------------------------------------------- data BufferTarget =@@ -97,20 +101,20 @@ marshalBufferTarget :: BufferTarget -> GLenum marshalBufferTarget x = case x of- ArrayBuffer -> gl_ARRAY_BUFFER- AtomicCounterBuffer -> gl_ATOMIC_COUNTER_BUFFER- CopyReadBuffer -> gl_COPY_READ_BUFFER- CopyWriteBuffer -> gl_COPY_WRITE_BUFFER- DispatchIndirectBuffer -> gl_DISPATCH_INDIRECT_BUFFER- DrawIndirectBuffer -> gl_DRAW_INDIRECT_BUFFER- ElementArrayBuffer -> gl_ELEMENT_ARRAY_BUFFER- PixelPackBuffer -> gl_PIXEL_PACK_BUFFER- PixelUnpackBuffer -> gl_PIXEL_UNPACK_BUFFER- QueryBuffer -> gl_QUERY_BUFFER- ShaderStorageBuffer -> gl_SHADER_STORAGE_BUFFER- TextureBuffer -> gl_TEXTURE_BUFFER- TransformFeedbackBuffer -> gl_TRANSFORM_FEEDBACK_BUFFER- UniformBuffer -> gl_UNIFORM_BUFFER+ ArrayBuffer -> GL_ARRAY_BUFFER+ AtomicCounterBuffer -> GL_ATOMIC_COUNTER_BUFFER+ CopyReadBuffer -> GL_COPY_READ_BUFFER+ CopyWriteBuffer -> GL_COPY_WRITE_BUFFER+ DispatchIndirectBuffer -> GL_DISPATCH_INDIRECT_BUFFER+ DrawIndirectBuffer -> GL_DRAW_INDIRECT_BUFFER+ ElementArrayBuffer -> GL_ELEMENT_ARRAY_BUFFER+ PixelPackBuffer -> GL_PIXEL_PACK_BUFFER+ PixelUnpackBuffer -> GL_PIXEL_UNPACK_BUFFER+ QueryBuffer -> GL_QUERY_BUFFER+ ShaderStorageBuffer -> GL_SHADER_STORAGE_BUFFER+ TextureBuffer -> GL_TEXTURE_BUFFER+ TransformFeedbackBuffer -> GL_TRANSFORM_FEEDBACK_BUFFER+ UniformBuffer -> GL_UNIFORM_BUFFER bufferTargetToGetPName :: BufferTarget -> PName1I bufferTargetToGetPName x = case x of@@ -145,27 +149,27 @@ marshalBufferUsage :: BufferUsage -> GLenum marshalBufferUsage x = case x of- StreamDraw -> gl_STREAM_DRAW- StreamRead -> gl_STREAM_READ- StreamCopy -> gl_STREAM_COPY- StaticDraw -> gl_STATIC_DRAW- StaticRead -> gl_STATIC_READ- StaticCopy -> gl_STATIC_COPY- DynamicDraw -> gl_DYNAMIC_DRAW- DynamicRead -> gl_DYNAMIC_READ- DynamicCopy -> gl_DYNAMIC_COPY+ StreamDraw -> GL_STREAM_DRAW+ StreamRead -> GL_STREAM_READ+ StreamCopy -> GL_STREAM_COPY+ StaticDraw -> GL_STATIC_DRAW+ StaticRead -> GL_STATIC_READ+ StaticCopy -> GL_STATIC_COPY+ DynamicDraw -> GL_DYNAMIC_DRAW+ DynamicRead -> GL_DYNAMIC_READ+ DynamicCopy -> GL_DYNAMIC_COPY unmarshalBufferUsage :: GLenum -> BufferUsage unmarshalBufferUsage x- | x == gl_STREAM_DRAW = StreamDraw- | x == gl_STREAM_READ = StreamRead- | x == gl_STREAM_COPY = StreamCopy- | x == gl_STATIC_DRAW = StaticDraw- | x == gl_STATIC_READ = StaticRead- | x == gl_STATIC_COPY = StaticCopy- | x == gl_DYNAMIC_DRAW = DynamicDraw- | x == gl_DYNAMIC_READ = DynamicRead- | x == gl_DYNAMIC_COPY = DynamicCopy+ | x == GL_STREAM_DRAW = StreamDraw+ | x == GL_STREAM_READ = StreamRead+ | x == GL_STREAM_COPY = StreamCopy+ | x == GL_STATIC_DRAW = StaticDraw+ | x == GL_STATIC_READ = StaticRead+ | x == GL_STATIC_COPY = StaticCopy+ | x == GL_DYNAMIC_DRAW = DynamicDraw+ | x == GL_DYNAMIC_READ = DynamicRead+ | x == GL_DYNAMIC_COPY = DynamicCopy | otherwise = error ("unmarshalBufferUsage: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -178,15 +182,15 @@ marshalBufferAccess :: BufferAccess -> GLenum marshalBufferAccess x = case x of- ReadOnly -> gl_READ_ONLY- WriteOnly -> gl_WRITE_ONLY- ReadWrite -> gl_READ_WRITE+ ReadOnly -> GL_READ_ONLY+ WriteOnly -> GL_WRITE_ONLY+ ReadWrite -> GL_READ_WRITE unmarshalBufferAccess :: GLenum -> BufferAccess unmarshalBufferAccess x- | x == gl_READ_ONLY = ReadOnly- | x == gl_WRITE_ONLY = WriteOnly- | x == gl_READ_WRITE = ReadWrite+ | x == GL_READ_ONLY = ReadOnly+ | x == GL_WRITE_ONLY = WriteOnly+ | x == GL_READ_WRITE = ReadWrite | otherwise = error ("unmarshalBufferAccess: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -272,10 +276,10 @@ marshalGetBufferPName :: GetBufferPName -> GLenum marshalGetBufferPName x = case x of- GetBufferSize -> gl_BUFFER_SIZE- GetBufferUsage -> gl_BUFFER_USAGE- GetBufferAccess -> gl_BUFFER_ACCESS- GetBufferMapped -> gl_BUFFER_MAPPED+ GetBufferSize -> GL_BUFFER_SIZE+ GetBufferUsage -> GL_BUFFER_USAGE+ GetBufferAccess -> GL_BUFFER_ACCESS+ GetBufferMapped -> GL_BUFFER_MAPPED getBufferParameter :: BufferTarget -> (GLenum -> a) -> GetBufferPName -> IO a getBufferParameter t f p = with 0 $ \buf -> do@@ -287,8 +291,8 @@ getBufferPointer :: BufferTarget -> IO (Ptr a) getBufferPointer t = with nullPtr $ \buf -> do- glGetBufferPointerv (marshalBufferTarget t) gl_BUFFER_MAP_POINTER buf- peek buf+ glGetBufferPointerv (marshalBufferTarget t) GL_BUFFER_MAP_POINTER buf+ peek1 id buf -------------------------------------------------------------------------------- @@ -342,12 +346,12 @@ marshalMapBufferUsage :: MapBufferUsage -> GLbitfield marshalMapBufferUsage x = case x of- Read -> gl_MAP_READ_BIT- Write -> gl_MAP_WRITE_BIT- InvalidateRange -> gl_MAP_INVALIDATE_RANGE_BIT- InvalidateBuffer -> gl_MAP_INVALIDATE_BUFFER_BIT- FlushExplicit -> gl_MAP_FLUSH_EXPLICIT_BIT- Unsychronized -> gl_MAP_FLUSH_EXPLICIT_BIT+ Read -> GL_MAP_READ_BIT+ Write -> GL_MAP_WRITE_BIT+ InvalidateRange -> GL_MAP_INVALIDATE_RANGE_BIT+ InvalidateBuffer -> GL_MAP_INVALIDATE_BUFFER_BIT+ FlushExplicit -> GL_MAP_FLUSH_EXPLICIT_BIT+ Unsychronized -> GL_MAP_FLUSH_EXPLICIT_BIT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/ByteString.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ByteString--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,12 +16,14 @@ module Graphics.Rendering.OpenGL.GL.ByteString ( B.ByteString, stringQuery, createAndTrimByteString, withByteString, withGLstring,- packUtf8, unpackUtf8+ packUtf8, unpackUtf8,+ getStringWith ) where +import Data.StateVar import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL import qualified Data.ByteString as B import qualified Data.ByteString.Internal as BI import qualified Data.ByteString.Unsafe as BU@@ -60,3 +62,9 @@ unpackUtf8 :: B.ByteString -> String unpackUtf8 = T.unpack . TE.decodeUtf8++getStringWith :: IO (Ptr GLubyte) -> IO String+getStringWith getStr = getStr >>= maybeNullPtr (return "") peekGLstring++peekGLstring :: Ptr GLubyte -> IO String+peekGLstring p = fmap unpackUtf8 $ BU.unsafePackCString (castPtr p)
src/Graphics/Rendering/OpenGL/GL/Capability.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Capability--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -21,11 +21,11 @@ IndexedEnableCap(..), makeIndexedCapability, ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -144,102 +144,102 @@ marshalEnableCap :: EnableCap -> Maybe GLenum marshalEnableCap x = case x of- CapFog -> Just gl_FOG- CapLighting -> Just gl_LIGHTING- CapTexture1D -> Just gl_TEXTURE_1D- CapTexture2D -> Just gl_TEXTURE_2D- CapTexture2DMultisample -> Just gl_TEXTURE_2D_MULTISAMPLE- CapTexture1DArray -> Just gl_TEXTURE_1D_ARRAY- CapTextureRectangle -> Just gl_TEXTURE_RECTANGLE- CapTextureCubeMap -> Just gl_TEXTURE_CUBE_MAP- CapTexture3D -> Just gl_TEXTURE_3D- CapTexture2DArray -> Just gl_TEXTURE_2D_ARRAY- CapTexture2DMultisampleArray -> Just gl_TEXTURE_2D_MULTISAMPLE_ARRAY- CapTextureCubeMapArray -> Just gl_TEXTURE_CUBE_MAP_ARRAY- CapLineStipple -> Just gl_LINE_STIPPLE- CapPolygonStipple -> Just gl_POLYGON_STIPPLE- CapCullFace -> Just gl_CULL_FACE- CapAlphaTest -> Just gl_ALPHA_TEST- CapBlend -> Just gl_BLEND- CapIndexLogicOp -> Just gl_INDEX_LOGIC_OP- CapColorLogicOp -> Just gl_COLOR_LOGIC_OP- CapDither -> Just gl_DITHER- CapStencilTest -> Just gl_STENCIL_TEST- CapDepthTest -> Just gl_DEPTH_TEST+ CapFog -> Just GL_FOG+ CapLighting -> Just GL_LIGHTING+ CapTexture1D -> Just GL_TEXTURE_1D+ CapTexture2D -> Just GL_TEXTURE_2D+ CapTexture2DMultisample -> Just GL_TEXTURE_2D_MULTISAMPLE+ CapTexture1DArray -> Just GL_TEXTURE_1D_ARRAY+ CapTextureRectangle -> Just GL_TEXTURE_RECTANGLE+ CapTextureCubeMap -> Just GL_TEXTURE_CUBE_MAP+ CapTexture3D -> Just GL_TEXTURE_3D+ CapTexture2DArray -> Just GL_TEXTURE_2D_ARRAY+ CapTexture2DMultisampleArray -> Just GL_TEXTURE_2D_MULTISAMPLE_ARRAY+ CapTextureCubeMapArray -> Just GL_TEXTURE_CUBE_MAP_ARRAY+ CapLineStipple -> Just GL_LINE_STIPPLE+ CapPolygonStipple -> Just GL_POLYGON_STIPPLE+ CapCullFace -> Just GL_CULL_FACE+ CapAlphaTest -> Just GL_ALPHA_TEST+ CapBlend -> Just GL_BLEND+ CapIndexLogicOp -> Just GL_INDEX_LOGIC_OP+ CapColorLogicOp -> Just GL_COLOR_LOGIC_OP+ CapDither -> Just GL_DITHER+ CapStencilTest -> Just GL_STENCIL_TEST+ CapDepthTest -> Just GL_DEPTH_TEST CapClipPlane i -> clipPlaneIndexToEnum i CapLight i -> lightIndexToEnum i- CapTextureGenS -> Just gl_TEXTURE_GEN_S- CapTextureGenT -> Just gl_TEXTURE_GEN_T- CapTextureGenR -> Just gl_TEXTURE_GEN_R- CapTextureGenQ -> Just gl_TEXTURE_GEN_Q- CapMap1Vertex3 -> Just gl_MAP1_VERTEX_3- CapMap1Vertex4 -> Just gl_MAP1_VERTEX_4- CapMap1Color4 -> Just gl_MAP1_COLOR_4- CapMap1Index -> Just gl_MAP1_INDEX- CapMap1Normal -> Just gl_MAP1_NORMAL- CapMap1TextureCoord1 -> Just gl_MAP1_TEXTURE_COORD_1- CapMap1TextureCoord2 -> Just gl_MAP1_TEXTURE_COORD_2- CapMap1TextureCoord3 -> Just gl_MAP1_TEXTURE_COORD_3- CapMap1TextureCoord4 -> Just gl_MAP1_TEXTURE_COORD_4- CapMap2Vertex3 -> Just gl_MAP2_VERTEX_3- CapMap2Vertex4 -> Just gl_MAP2_VERTEX_4- CapMap2Color4 -> Just gl_MAP2_COLOR_4- CapMap2Index -> Just gl_MAP2_INDEX- CapMap2Normal -> Just gl_MAP2_NORMAL- CapMap2TextureCoord1 -> Just gl_MAP2_TEXTURE_COORD_1- CapMap2TextureCoord2 -> Just gl_MAP2_TEXTURE_COORD_2- CapMap2TextureCoord3 -> Just gl_MAP2_TEXTURE_COORD_3- CapMap2TextureCoord4 -> Just gl_MAP2_TEXTURE_COORD_4- CapPointSmooth -> Just gl_POINT_SMOOTH- CapLineSmooth -> Just gl_LINE_SMOOTH- CapPolygonSmooth -> Just gl_POLYGON_SMOOTH- CapScissorTest -> Just gl_SCISSOR_TEST- CapColorMaterial -> Just gl_COLOR_MATERIAL- CapNormalize -> Just gl_NORMALIZE- CapAutoNormal -> Just gl_AUTO_NORMAL- CapPolygonOffsetPoint -> Just gl_POLYGON_OFFSET_POINT- CapPolygonOffsetLine -> Just gl_POLYGON_OFFSET_LINE- CapPolygonOffsetFill -> Just gl_POLYGON_OFFSET_FILL- CapVertexArray -> Just gl_VERTEX_ARRAY- CapNormalArray -> Just gl_NORMAL_ARRAY- CapColorArray -> Just gl_COLOR_ARRAY- CapIndexArray -> Just gl_INDEX_ARRAY- CapTextureCoordArray -> Just gl_TEXTURE_COORD_ARRAY- CapEdgeFlagArray -> Just gl_EDGE_FLAG_ARRAY- CapFogCoordArray -> Just gl_FOG_COORD_ARRAY- CapSecondaryColorArray -> Just gl_SECONDARY_COLOR_ARRAY- CapMatrixIndexArray -> Just gl_MATRIX_INDEX_ARRAY_ARB- CapConvolution1D -> Just gl_CONVOLUTION_1D- CapConvolution2D -> Just gl_CONVOLUTION_2D- CapSeparable2D -> Just gl_SEPARABLE_2D- CapHistogram -> Just gl_HISTOGRAM- CapMinmax -> Just gl_MINMAX- CapRescaleNormal -> Just gl_RESCALE_NORMAL- CapSharedTexturePalette -> Just gl_SHARED_TEXTURE_PALETTE_EXT- CapMultisample -> Just gl_MULTISAMPLE- CapSampleAlphaToCoverage -> Just gl_SAMPLE_ALPHA_TO_COVERAGE- CapSampleAlphaToOne -> Just gl_SAMPLE_ALPHA_TO_ONE- CapSampleCoverage -> Just gl_SAMPLE_COVERAGE- CapColorTable -> Just gl_COLOR_TABLE- CapPostConvolutionColorTable -> Just gl_POST_CONVOLUTION_COLOR_TABLE- CapPostColorMatrixColorTable -> Just gl_POST_COLOR_MATRIX_COLOR_TABLE- CapColorSum -> Just gl_COLOR_SUM- CapWeightSumUnity -> Just gl_WEIGHT_SUM_UNITY_ARB- CapVertexBlend -> Just gl_VERTEX_BLEND_ARB- CapWeightArray -> Just gl_WEIGHT_ARRAY_ARB- CapMatrixPalette -> Just gl_MATRIX_PALETTE_ARB- CapDepthClamp -> Just gl_DEPTH_CLAMP- CapDepthBoundsTest -> Just gl_DEPTH_BOUNDS_TEST_EXT- CapPrimitiveRestart -> Just gl_PRIMITIVE_RESTART- CapPointSprite -> Just gl_POINT_SPRITE- CapStencilTestTwoSide -> Just gl_STENCIL_TEST_TWO_SIDE_EXT- CapRasterPositionUnclipped -> Just gl_RASTER_POSITION_UNCLIPPED_IBM- CapRasterizerDiscard -> Just gl_RASTERIZER_DISCARD- CapTextureColorTable -> Just gl_TEXTURE_COLOR_TABLE_SGI- CapVertexProgramPointSize -> Just gl_VERTEX_PROGRAM_POINT_SIZE- CapVertexProgramTwoSide -> Just gl_VERTEX_PROGRAM_TWO_SIDE- CapDebugOutput -> Just gl_DEBUG_OUTPUT- CapDebugOutputSynchronous -> Just gl_DEBUG_OUTPUT_SYNCHRONOUS+ CapTextureGenS -> Just GL_TEXTURE_GEN_S+ CapTextureGenT -> Just GL_TEXTURE_GEN_T+ CapTextureGenR -> Just GL_TEXTURE_GEN_R+ CapTextureGenQ -> Just GL_TEXTURE_GEN_Q+ CapMap1Vertex3 -> Just GL_MAP1_VERTEX_3+ CapMap1Vertex4 -> Just GL_MAP1_VERTEX_4+ CapMap1Color4 -> Just GL_MAP1_COLOR_4+ CapMap1Index -> Just GL_MAP1_INDEX+ CapMap1Normal -> Just GL_MAP1_NORMAL+ CapMap1TextureCoord1 -> Just GL_MAP1_TEXTURE_COORD_1+ CapMap1TextureCoord2 -> Just GL_MAP1_TEXTURE_COORD_2+ CapMap1TextureCoord3 -> Just GL_MAP1_TEXTURE_COORD_3+ CapMap1TextureCoord4 -> Just GL_MAP1_TEXTURE_COORD_4+ CapMap2Vertex3 -> Just GL_MAP2_VERTEX_3+ CapMap2Vertex4 -> Just GL_MAP2_VERTEX_4+ CapMap2Color4 -> Just GL_MAP2_COLOR_4+ CapMap2Index -> Just GL_MAP2_INDEX+ CapMap2Normal -> Just GL_MAP2_NORMAL+ CapMap2TextureCoord1 -> Just GL_MAP2_TEXTURE_COORD_1+ CapMap2TextureCoord2 -> Just GL_MAP2_TEXTURE_COORD_2+ CapMap2TextureCoord3 -> Just GL_MAP2_TEXTURE_COORD_3+ CapMap2TextureCoord4 -> Just GL_MAP2_TEXTURE_COORD_4+ CapPointSmooth -> Just GL_POINT_SMOOTH+ CapLineSmooth -> Just GL_LINE_SMOOTH+ CapPolygonSmooth -> Just GL_POLYGON_SMOOTH+ CapScissorTest -> Just GL_SCISSOR_TEST+ CapColorMaterial -> Just GL_COLOR_MATERIAL+ CapNormalize -> Just GL_NORMALIZE+ CapAutoNormal -> Just GL_AUTO_NORMAL+ CapPolygonOffsetPoint -> Just GL_POLYGON_OFFSET_POINT+ CapPolygonOffsetLine -> Just GL_POLYGON_OFFSET_LINE+ CapPolygonOffsetFill -> Just GL_POLYGON_OFFSET_FILL+ CapVertexArray -> Just GL_VERTEX_ARRAY+ CapNormalArray -> Just GL_NORMAL_ARRAY+ CapColorArray -> Just GL_COLOR_ARRAY+ CapIndexArray -> Just GL_INDEX_ARRAY+ CapTextureCoordArray -> Just GL_TEXTURE_COORD_ARRAY+ CapEdgeFlagArray -> Just GL_EDGE_FLAG_ARRAY+ CapFogCoordArray -> Just GL_FOG_COORD_ARRAY+ CapSecondaryColorArray -> Just GL_SECONDARY_COLOR_ARRAY+ CapMatrixIndexArray -> Just GL_MATRIX_INDEX_ARRAY_ARB+ CapConvolution1D -> Just GL_CONVOLUTION_1D+ CapConvolution2D -> Just GL_CONVOLUTION_2D+ CapSeparable2D -> Just GL_SEPARABLE_2D+ CapHistogram -> Just GL_HISTOGRAM+ CapMinmax -> Just GL_MINMAX+ CapRescaleNormal -> Just GL_RESCALE_NORMAL+ CapSharedTexturePalette -> Just GL_SHARED_TEXTURE_PALETTE_EXT+ CapMultisample -> Just GL_MULTISAMPLE+ CapSampleAlphaToCoverage -> Just GL_SAMPLE_ALPHA_TO_COVERAGE+ CapSampleAlphaToOne -> Just GL_SAMPLE_ALPHA_TO_ONE+ CapSampleCoverage -> Just GL_SAMPLE_COVERAGE+ CapColorTable -> Just GL_COLOR_TABLE+ CapPostConvolutionColorTable -> Just GL_POST_CONVOLUTION_COLOR_TABLE+ CapPostColorMatrixColorTable -> Just GL_POST_COLOR_MATRIX_COLOR_TABLE+ CapColorSum -> Just GL_COLOR_SUM+ CapWeightSumUnity -> Just GL_WEIGHT_SUM_UNITY_ARB+ CapVertexBlend -> Just GL_VERTEX_BLEND_ARB+ CapWeightArray -> Just GL_WEIGHT_ARRAY_ARB+ CapMatrixPalette -> Just GL_MATRIX_PALETTE_ARB+ CapDepthClamp -> Just GL_DEPTH_CLAMP+ CapDepthBoundsTest -> Just GL_DEPTH_BOUNDS_TEST_EXT+ CapPrimitiveRestart -> Just GL_PRIMITIVE_RESTART+ CapPointSprite -> Just GL_POINT_SPRITE+ CapStencilTestTwoSide -> Just GL_STENCIL_TEST_TWO_SIDE_EXT+ CapRasterPositionUnclipped -> Just GL_RASTER_POSITION_UNCLIPPED_IBM+ CapRasterizerDiscard -> Just GL_RASTERIZER_DISCARD+ CapTextureColorTable -> Just GL_TEXTURE_COLOR_TABLE_SGI+ CapVertexProgramPointSize -> Just GL_VERTEX_PROGRAM_POINT_SIZE+ CapVertexProgramTwoSide -> Just GL_VERTEX_PROGRAM_TWO_SIDE+ CapDebugOutput -> Just GL_DEBUG_OUTPUT+ CapDebugOutputSynchronous -> Just GL_DEBUG_OUTPUT_SYNCHRONOUS -------------------------------------------------------------------------------- @@ -289,7 +289,7 @@ marshalIndexedEnableCap :: IndexedEnableCap -> Maybe GLenum marshalIndexedEnableCap x = case x of- BlendI -> Just gl_BLEND+ BlendI -> Just GL_BLEND makeIndexedCapability ::(a -> GLuint) -> IndexedEnableCap -> a -> StateVar Capability
src/Graphics/Rendering/OpenGL/GL/Clipping.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Clipping--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,6 +17,7 @@ ClipPlaneName(..), clipPlane, maxClipPlanes ) where +import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr@@ -24,9 +25,8 @@ import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/ColorSum.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ColorSum--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,7 +16,7 @@ colorSum ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Colors.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Colors--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -44,12 +44,12 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Array import Foreign.Marshal.Utils import Foreign.Ptr import Foreign.Storable-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.Face@@ -57,7 +57,7 @@ import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -89,13 +89,13 @@ marshalFrontFaceDirection :: FrontFaceDirection -> GLenum marshalFrontFaceDirection x = case x of- CW -> gl_CW- CCW -> gl_CCW+ CW -> GL_CW+ CCW -> GL_CCW unmarshalFrontFaceDirection :: GLenum -> FrontFaceDirection unmarshalFrontFaceDirection x- | x == gl_CW = CW- | x == gl_CCW = CCW+ | x == GL_CW = CW+ | x == GL_CCW = CCW | otherwise = error ("unmarshalFrontFaceDirection: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -119,13 +119,13 @@ marshalMaterialParameter :: MaterialParameter -> GLenum marshalMaterialParameter x = case x of- MaterialEmission -> gl_EMISSION- MaterialShininess -> gl_SHININESS- MaterialAmbientAndDiffuse -> gl_AMBIENT_AND_DIFFUSE- MaterialColorIndexes -> gl_COLOR_INDEXES- MaterialAmbient -> gl_AMBIENT- MaterialDiffuse -> gl_DIFFUSE- MaterialSpecular -> gl_SPECULAR+ MaterialEmission -> GL_EMISSION+ MaterialShininess -> GL_SHININESS+ MaterialAmbientAndDiffuse -> GL_AMBIENT_AND_DIFFUSE+ MaterialColorIndexes -> GL_COLOR_INDEXES+ MaterialAmbient -> GL_AMBIENT+ MaterialDiffuse -> GL_DIFFUSE+ MaterialSpecular -> GL_SPECULAR -------------------------------------------------------------------------------- @@ -221,16 +221,16 @@ marshalLightParameter :: LightParameter -> GLenum marshalLightParameter x = case x of- Ambient' -> gl_AMBIENT- Diffuse' -> gl_DIFFUSE- Specular' -> gl_SPECULAR- Position -> gl_POSITION- SpotDirection -> gl_SPOT_DIRECTION- SpotExponent -> gl_SPOT_EXPONENT- SpotCutoff -> gl_SPOT_CUTOFF- ConstantAttenuation -> gl_CONSTANT_ATTENUATION- LinearAttenuation -> gl_LINEAR_ATTENUATION- QuadraticAttenuation -> gl_QUADRATIC_ATTENUATION+ Ambient' -> GL_AMBIENT+ Diffuse' -> GL_DIFFUSE+ Specular' -> GL_SPECULAR+ Position -> GL_POSITION+ SpotDirection -> GL_SPOT_DIRECTION+ SpotExponent -> GL_SPOT_EXPONENT+ SpotCutoff -> GL_SPOT_CUTOFF+ ConstantAttenuation -> GL_CONSTANT_ATTENUATION+ LinearAttenuation -> GL_LINEAR_ATTENUATION+ QuadraticAttenuation -> GL_QUADRATIC_ATTENUATION -------------------------------------------------------------------------------- @@ -333,10 +333,10 @@ marshalLightModelParameter :: LightModelParameter -> GLenum marshalLightModelParameter x = case x of- LightModelAmbient -> gl_LIGHT_MODEL_AMBIENT- LightModelLocalViewer -> gl_LIGHT_MODEL_LOCAL_VIEWER- LightModelTwoSide -> gl_LIGHT_MODEL_TWO_SIDE- LightModelColorControl -> gl_LIGHT_MODEL_COLOR_CONTROL+ LightModelAmbient -> GL_LIGHT_MODEL_AMBIENT+ LightModelLocalViewer -> GL_LIGHT_MODEL_LOCAL_VIEWER+ LightModelTwoSide -> GL_LIGHT_MODEL_TWO_SIDE+ LightModelColorControl -> GL_LIGHT_MODEL_COLOR_CONTROL -------------------------------------------------------------------------------- @@ -377,13 +377,13 @@ marshalLightModelColorControl :: LightModelColorControl -> GLenum marshalLightModelColorControl x = case x of- SingleColor -> gl_SINGLE_COLOR- SeparateSpecularColor -> gl_SEPARATE_SPECULAR_COLOR+ SingleColor -> GL_SINGLE_COLOR+ SeparateSpecularColor -> GL_SEPARATE_SPECULAR_COLOR unmarshalLightModelColorControl :: GLenum -> LightModelColorControl unmarshalLightModelColorControl x- | x == gl_SINGLE_COLOR = SingleColor- | x == gl_SEPARATE_SPECULAR_COLOR = SeparateSpecularColor+ | x == GL_SINGLE_COLOR = SingleColor+ | x == GL_SEPARATE_SPECULAR_COLOR = SeparateSpecularColor | otherwise = error ("unmarshalLightModelColorControl: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -407,19 +407,19 @@ marshalColorMaterialParameter :: ColorMaterialParameter -> GLenum marshalColorMaterialParameter x = case x of- Ambient -> gl_AMBIENT- Diffuse -> gl_DIFFUSE- Specular -> gl_SPECULAR- Emission -> gl_EMISSION- AmbientAndDiffuse -> gl_AMBIENT_AND_DIFFUSE+ Ambient -> GL_AMBIENT+ Diffuse -> GL_DIFFUSE+ Specular -> GL_SPECULAR+ Emission -> GL_EMISSION+ AmbientAndDiffuse -> GL_AMBIENT_AND_DIFFUSE unmarshalColorMaterialParameter :: GLenum -> ColorMaterialParameter unmarshalColorMaterialParameter x- | x == gl_AMBIENT = Ambient- | x == gl_DIFFUSE = Diffuse- | x == gl_SPECULAR = Specular- | x == gl_EMISSION = Emission- | x == gl_AMBIENT_AND_DIFFUSE = AmbientAndDiffuse+ | x == GL_AMBIENT = Ambient+ | x == GL_DIFFUSE = Diffuse+ | x == GL_SPECULAR = Specular+ | x == GL_EMISSION = Emission+ | x == GL_AMBIENT_AND_DIFFUSE = AmbientAndDiffuse | otherwise = error ("unmarshalColorMaterialParameter: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -444,13 +444,13 @@ marshalShadingModel :: ShadingModel -> GLenum marshalShadingModel x = case x of- Flat -> gl_FLAT- Smooth -> gl_SMOOTH+ Flat -> GL_FLAT+ Smooth -> GL_SMOOTH unmarshalShadingModel :: GLenum -> ShadingModel unmarshalShadingModel x- | x == gl_FLAT = Flat- | x == gl_SMOOTH = Smooth+ | x == GL_FLAT = Flat+ | x == GL_SMOOTH = Smooth | otherwise = error ("unmarshalShadingModel: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -471,9 +471,9 @@ marshalClampTarget :: ClampTarget -> GLenum marshalClampTarget x = case x of- ClampVertexColor -> gl_CLAMP_VERTEX_COLOR- ClampFragmentColor -> gl_CLAMP_FRAGMENT_COLOR- ClampReadColor -> gl_CLAMP_READ_COLOR+ ClampVertexColor -> GL_CLAMP_VERTEX_COLOR+ ClampFragmentColor -> GL_CLAMP_FRAGMENT_COLOR+ ClampReadColor -> GL_CLAMP_READ_COLOR marshalClampTargetToPName :: ClampTarget -> PName1I marshalClampTargetToPName x = case x of@@ -491,15 +491,15 @@ marshalClampMode :: ClampMode -> GLenum marshalClampMode x = case x of- ClampOn -> gl_TRUE- FixedOnly -> gl_FIXED_ONLY- ClampOff -> gl_FALSE+ ClampOn -> fromIntegral GL_TRUE+ FixedOnly -> GL_FIXED_ONLY+ ClampOff -> fromIntegral GL_FALSE unmarshalClampMode :: GLenum -> ClampMode unmarshalClampMode x- | x == gl_TRUE = ClampOn- | x == gl_FIXED_ONLY = FixedOnly- | x == gl_FALSE = ClampOff+ | x == fromIntegral GL_TRUE = ClampOn+ | x == GL_FIXED_ONLY = FixedOnly+ | x == fromIntegral GL_FALSE = ClampOff | otherwise = error $ "unmarshalClampMode: unknown enum value " ++ show x --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/ComparisonFunction.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ComparisonFunction--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ unmarshalComparisonFunction ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -35,23 +35,23 @@ marshalComparisonFunction :: ComparisonFunction -> GLenum marshalComparisonFunction x = case x of- Never -> gl_NEVER- Less -> gl_LESS- Equal -> gl_EQUAL- Lequal -> gl_LEQUAL- Greater -> gl_GREATER- Notequal -> gl_NOTEQUAL- Gequal -> gl_GEQUAL- Always -> gl_ALWAYS+ Never -> GL_NEVER+ Less -> GL_LESS+ Equal -> GL_EQUAL+ Lequal -> GL_LEQUAL+ Greater -> GL_GREATER+ Notequal -> GL_NOTEQUAL+ Gequal -> GL_GEQUAL+ Always -> GL_ALWAYS unmarshalComparisonFunction :: GLenum -> ComparisonFunction unmarshalComparisonFunction x- | x == gl_NEVER = Never- | x == gl_LESS = Less- | x == gl_EQUAL = Equal- | x == gl_LEQUAL = Lequal- | x == gl_GREATER = Greater- | x == gl_NOTEQUAL = Notequal- | x == gl_GEQUAL = Gequal- | x == gl_ALWAYS = Always+ | x == GL_NEVER = Never+ | x == GL_LESS = Less+ | x == GL_EQUAL = Equal+ | x == GL_LEQUAL = Lequal+ | x == GL_GREATER = Greater+ | x == GL_NOTEQUAL = Notequal+ | x == GL_GEQUAL = Gequal+ | x == GL_ALWAYS = Always | otherwise = error ("unmarshalComparisonFunction: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/ConditionalRendering.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ConditionalRendering--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,7 +20,7 @@ import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.QueryObject-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -33,10 +33,10 @@ marshalConditionalRenderMode :: ConditionalRenderMode -> GLenum marshalConditionalRenderMode x = case x of- QueryWait -> gl_QUERY_WAIT- QueryNoWait -> gl_QUERY_NO_WAIT- QueryByRegionWait -> gl_QUERY_BY_REGION_WAIT- QueryByRegionNoWait -> gl_QUERY_BY_REGION_NO_WAIT+ QueryWait -> GL_QUERY_WAIT+ QueryNoWait -> GL_QUERY_NO_WAIT+ QueryByRegionWait -> GL_QUERY_BY_REGION_WAIT+ QueryByRegionNoWait -> GL_QUERY_BY_REGION_NO_WAIT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/ControlPoint.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ControlPoint--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -24,7 +24,7 @@ import Graphics.Rendering.OpenGL.GL.Domain import Graphics.Rendering.OpenGL.GL.VertexArrays import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -142,21 +142,21 @@ marshalMapTarget :: MapTarget -> GLenum marshalMapTarget x = case x of- Map1Color4 -> gl_MAP1_COLOR_4- Map1Index -> gl_MAP1_INDEX- Map1Normal -> gl_MAP1_NORMAL- Map1TextureCoord1 -> gl_MAP1_TEXTURE_COORD_1- Map1TextureCoord2 -> gl_MAP1_TEXTURE_COORD_2- Map1TextureCoord3 -> gl_MAP1_TEXTURE_COORD_3- Map1TextureCoord4 -> gl_MAP1_TEXTURE_COORD_4- Map1Vertex3 -> gl_MAP1_VERTEX_3- Map1Vertex4 -> gl_MAP1_VERTEX_4- Map2Color4 -> gl_MAP2_COLOR_4- Map2Index -> gl_MAP2_INDEX- Map2Normal -> gl_MAP2_NORMAL- Map2TextureCoord1 -> gl_MAP2_TEXTURE_COORD_1- Map2TextureCoord2 -> gl_MAP2_TEXTURE_COORD_2- Map2TextureCoord3 -> gl_MAP2_TEXTURE_COORD_3- Map2TextureCoord4 -> gl_MAP2_TEXTURE_COORD_4- Map2Vertex3 -> gl_MAP2_VERTEX_3- Map2Vertex4 -> gl_MAP2_VERTEX_4+ Map1Color4 -> GL_MAP1_COLOR_4+ Map1Index -> GL_MAP1_INDEX+ Map1Normal -> GL_MAP1_NORMAL+ Map1TextureCoord1 -> GL_MAP1_TEXTURE_COORD_1+ Map1TextureCoord2 -> GL_MAP1_TEXTURE_COORD_2+ Map1TextureCoord3 -> GL_MAP1_TEXTURE_COORD_3+ Map1TextureCoord4 -> GL_MAP1_TEXTURE_COORD_4+ Map1Vertex3 -> GL_MAP1_VERTEX_3+ Map1Vertex4 -> GL_MAP1_VERTEX_4+ Map2Color4 -> GL_MAP2_COLOR_4+ Map2Index -> GL_MAP2_INDEX+ Map2Normal -> GL_MAP2_NORMAL+ Map2TextureCoord1 -> GL_MAP2_TEXTURE_COORD_1+ Map2TextureCoord2 -> GL_MAP2_TEXTURE_COORD_2+ Map2TextureCoord3 -> GL_MAP2_TEXTURE_COORD_3+ Map2TextureCoord4 -> GL_MAP2_TEXTURE_COORD_4+ Map2Vertex3 -> GL_MAP2_VERTEX_3+ Map2Vertex4 -> GL_MAP2_VERTEX_4
src/Graphics/Rendering/OpenGL/GL/CoordTrans.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.CoordTrans--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -13,8 +13,6 @@ -- -------------------------------------------------------------------------------- -{-# LANGUAGE TypeSynonymInstances #-}- module Graphics.Rendering.OpenGL.GL.CoordTrans ( -- * Controlling the Viewport depthRange,@@ -36,21 +34,21 @@ Plane(..), TextureCoordName(..), TextureGenMode(..), textureGenMode ) where +import Data.StateVar import Foreign.ForeignPtr import Foreign.Marshal.Alloc import Foreign.Marshal.Array import Foreign.Marshal.Utils import Foreign.Ptr import Foreign.Storable-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.Exception+import Graphics.Rendering.OpenGL.GL.MatrixComponent import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -123,17 +121,17 @@ marshalMatrixMode :: MatrixMode -> Maybe GLenum marshalMatrixMode x = case x of Modelview i -> modelviewIndexToEnum i- Projection -> Just gl_PROJECTION- Texture -> Just gl_TEXTURE- Color -> Just gl_COLOR- MatrixPalette -> Just gl_MATRIX_PALETTE_ARB+ Projection -> Just GL_PROJECTION+ Texture -> Just GL_TEXTURE+ Color -> Just GL_COLOR+ MatrixPalette -> Just GL_MATRIX_PALETTE_ARB unmarshalMatrixMode :: GLenum -> MatrixMode unmarshalMatrixMode x- | x == gl_PROJECTION = Projection- | x == gl_TEXTURE = Texture- | x == gl_COLOR = Color- | x == gl_MATRIX_PALETTE_ARB = MatrixPalette+ | x == GL_PROJECTION = Projection+ | x == GL_TEXTURE = Texture+ | x == GL_COLOR = Color+ | x == GL_MATRIX_PALETTE_ARB = MatrixPalette | otherwise = case modelviewEnumToIndex x of Just i -> Modelview i@@ -180,38 +178,6 @@ -------------------------------------------------------------------------------- -class Storable c => MatrixComponent c where- getMatrix :: GetPNameMatrix p => p -> Ptr c -> IO ()- loadMatrix :: Ptr c -> IO ()- loadTransposeMatrix :: Ptr c -> IO ()- multMatrix_ :: Ptr c -> IO ()- multTransposeMatrix :: Ptr c -> IO ()- rotate :: c -> Vector3 c -> IO ()- translate :: Vector3 c -> IO ()- scale :: c -> c -> c -> IO ()--instance MatrixComponent GLfloat where- getMatrix = getMatrixf- loadMatrix = glLoadMatrixf- loadTransposeMatrix = glLoadTransposeMatrixf- multMatrix_ = glMultMatrixf- multTransposeMatrix = glMultTransposeMatrixf- rotate a (Vector3 x y z) = glRotatef a x y z- translate (Vector3 x y z) = glTranslatef x y z- scale = glScalef--instance MatrixComponent GLdouble where- getMatrix = getMatrixd- loadMatrix = glLoadMatrixd- loadTransposeMatrix = glLoadTransposeMatrixd- multMatrix_ = glMultMatrixd- multTransposeMatrix = glMultTransposeMatrixd- rotate a (Vector3 x y z) = glRotated a x y z- translate (Vector3 x y z) = glTranslated x y z- scale = glScaled----------------------------------------------------------------------------------- class Matrix m where -- | Create a new matrix of the given order (containing undefined elements) -- and call the action to fill it with 4x4 elements.@@ -394,10 +360,10 @@ marshalTextureCoordName :: TextureCoordName -> GLenum marshalTextureCoordName x = case x of- S -> gl_S- T -> gl_T- R -> gl_R- Q -> gl_Q+ S -> GL_S+ T -> GL_T+ R -> GL_R+ Q -> GL_Q -------------------------------------------------------------------------------- @@ -408,9 +374,9 @@ marshalTextureGenParameter :: TextureGenParameter -> GLenum marshalTextureGenParameter x = case x of- TextureGenMode -> gl_TEXTURE_GEN_MODE- ObjectPlane -> gl_OBJECT_PLANE- EyePlane -> gl_EYE_PLANE+ TextureGenMode -> GL_TEXTURE_GEN_MODE+ ObjectPlane -> GL_OBJECT_PLANE+ EyePlane -> GL_EYE_PLANE -------------------------------------------------------------------------------- @@ -423,19 +389,19 @@ marshalTextureGenMode' :: TextureGenMode' -> GLint marshalTextureGenMode' x = fromIntegral $ case x of- EyeLinear' -> gl_EYE_LINEAR- ObjectLinear' -> gl_OBJECT_LINEAR- SphereMap' -> gl_SPHERE_MAP- NormalMap' -> gl_NORMAL_MAP- ReflectionMap' -> gl_REFLECTION_MAP+ EyeLinear' -> GL_EYE_LINEAR+ ObjectLinear' -> GL_OBJECT_LINEAR+ SphereMap' -> GL_SPHERE_MAP+ NormalMap' -> GL_NORMAL_MAP+ ReflectionMap' -> GL_REFLECTION_MAP unmarshalTextureGenMode' :: GLint -> TextureGenMode' unmarshalTextureGenMode' x- | y == gl_EYE_LINEAR = EyeLinear'- | y == gl_OBJECT_LINEAR = ObjectLinear'- | y == gl_SPHERE_MAP = SphereMap'- | y == gl_NORMAL_MAP = NormalMap'- | y == gl_REFLECTION_MAP = ReflectionMap'+ | y == GL_EYE_LINEAR = EyeLinear'+ | y == GL_OBJECT_LINEAR = ObjectLinear'+ | y == GL_SPHERE_MAP = SphereMap'+ | y == GL_NORMAL_MAP = NormalMap'+ | y == GL_REFLECTION_MAP = ReflectionMap' | otherwise = error ("unmarshalTextureGenMode': illegal value " ++ show x) where y = fromIntegral x
src/Graphics/Rendering/OpenGL/GL/DataType.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.DataType--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,14 +15,14 @@ module Graphics.Rendering.OpenGL.GL.DataType ( DataType(..), marshalDataType, unmarshalDataType,- DataTypeType(..), marshalDataTypeType, unmarshalDataTypeType+ DataRepresentation(..), unmarshalDataRepresentation ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- --- basically table 3.2 (pixel data type parameter) plus a few additions+-- basically table 8.7 (pixel data type parameter) plus a few additions data DataType = UnsignedByte | Byte@@ -59,96 +59,87 @@ marshalDataType :: DataType -> GLenum marshalDataType x = case x of- UnsignedByte -> gl_UNSIGNED_BYTE- Byte -> gl_BYTE- UnsignedShort -> gl_UNSIGNED_SHORT- Short -> gl_SHORT- UnsignedInt -> gl_UNSIGNED_INT- Int -> gl_INT- HalfFloat -> gl_HALF_FLOAT- Float -> gl_FLOAT- UnsignedByte332 -> gl_UNSIGNED_BYTE_3_3_2- UnsignedByte233Rev -> gl_UNSIGNED_BYTE_2_3_3_REV- UnsignedShort565 -> gl_UNSIGNED_SHORT_5_6_5- UnsignedShort565Rev -> gl_UNSIGNED_SHORT_5_6_5_REV- UnsignedShort4444 -> gl_UNSIGNED_SHORT_4_4_4_4- UnsignedShort4444Rev -> gl_UNSIGNED_SHORT_4_4_4_4_REV- UnsignedShort5551 -> gl_UNSIGNED_SHORT_5_5_5_1- UnsignedShort1555Rev -> gl_UNSIGNED_SHORT_1_5_5_5_REV- UnsignedInt8888 -> gl_UNSIGNED_INT_8_8_8_8- UnsignedInt8888Rev -> gl_UNSIGNED_INT_8_8_8_8_REV- UnsignedInt1010102 -> gl_UNSIGNED_INT_10_10_10_2- UnsignedInt2101010Rev -> gl_UNSIGNED_INT_2_10_10_10_REV- UnsignedInt248 -> gl_UNSIGNED_INT_24_8- UnsignedInt10f11f11fRev -> gl_UNSIGNED_INT_10F_11F_11F_REV- UnsignedInt5999Rev -> gl_UNSIGNED_INT_5_9_9_9_REV- Float32UnsignedInt248Rev -> gl_FLOAT_32_UNSIGNED_INT_24_8_REV- Bitmap -> gl_BITMAP- UnsignedShort88 -> gl_UNSIGNED_SHORT_8_8_APPLE- UnsignedShort88Rev -> gl_UNSIGNED_SHORT_8_8_REV_APPLE- Double -> gl_DOUBLE- TwoBytes -> gl_2_BYTES- ThreeBytes -> gl_3_BYTES- FourBytes -> gl_4_BYTES+ UnsignedByte -> GL_UNSIGNED_BYTE+ Byte -> GL_BYTE+ UnsignedShort -> GL_UNSIGNED_SHORT+ Short -> GL_SHORT+ UnsignedInt -> GL_UNSIGNED_INT+ Int -> GL_INT+ HalfFloat -> GL_HALF_FLOAT+ Float -> GL_FLOAT+ UnsignedByte332 -> GL_UNSIGNED_BYTE_3_3_2+ UnsignedByte233Rev -> GL_UNSIGNED_BYTE_2_3_3_REV+ UnsignedShort565 -> GL_UNSIGNED_SHORT_5_6_5+ UnsignedShort565Rev -> GL_UNSIGNED_SHORT_5_6_5_REV+ UnsignedShort4444 -> GL_UNSIGNED_SHORT_4_4_4_4+ UnsignedShort4444Rev -> GL_UNSIGNED_SHORT_4_4_4_4_REV+ UnsignedShort5551 -> GL_UNSIGNED_SHORT_5_5_5_1+ UnsignedShort1555Rev -> GL_UNSIGNED_SHORT_1_5_5_5_REV+ UnsignedInt8888 -> GL_UNSIGNED_INT_8_8_8_8+ UnsignedInt8888Rev -> GL_UNSIGNED_INT_8_8_8_8_REV+ UnsignedInt1010102 -> GL_UNSIGNED_INT_10_10_10_2+ UnsignedInt2101010Rev -> GL_UNSIGNED_INT_2_10_10_10_REV+ UnsignedInt248 -> GL_UNSIGNED_INT_24_8+ UnsignedInt10f11f11fRev -> GL_UNSIGNED_INT_10F_11F_11F_REV+ UnsignedInt5999Rev -> GL_UNSIGNED_INT_5_9_9_9_REV+ Float32UnsignedInt248Rev -> GL_FLOAT_32_UNSIGNED_INT_24_8_REV+ Bitmap -> GL_BITMAP+ UnsignedShort88 -> GL_UNSIGNED_SHORT_8_8_APPLE+ UnsignedShort88Rev -> GL_UNSIGNED_SHORT_8_8_REV_APPLE+ Double -> GL_DOUBLE+ TwoBytes -> GL_2_BYTES+ ThreeBytes -> GL_3_BYTES+ FourBytes -> GL_4_BYTES unmarshalDataType :: GLenum -> DataType unmarshalDataType x- | x == gl_UNSIGNED_BYTE = UnsignedByte- | x == gl_BYTE = Byte- | x == gl_UNSIGNED_SHORT = UnsignedShort- | x == gl_SHORT = Short- | x == gl_UNSIGNED_INT = UnsignedInt- | x == gl_INT = Int- | x == gl_HALF_FLOAT = HalfFloat- | x == gl_FLOAT = Float- | x == gl_UNSIGNED_BYTE_3_3_2 = UnsignedByte332- | x == gl_UNSIGNED_BYTE_2_3_3_REV = UnsignedByte233Rev- | x == gl_UNSIGNED_SHORT_5_6_5 = UnsignedShort565- | x == gl_UNSIGNED_SHORT_5_6_5_REV = UnsignedShort565Rev- | x == gl_UNSIGNED_SHORT_4_4_4_4 = UnsignedShort4444- | x == gl_UNSIGNED_SHORT_4_4_4_4_REV = UnsignedShort4444Rev- | x == gl_UNSIGNED_SHORT_5_5_5_1 = UnsignedShort5551- | x == gl_UNSIGNED_SHORT_1_5_5_5_REV = UnsignedShort1555Rev- | x == gl_UNSIGNED_INT_8_8_8_8 = UnsignedInt8888- | x == gl_UNSIGNED_INT_8_8_8_8_REV = UnsignedInt8888Rev- | x == gl_UNSIGNED_INT_10_10_10_2 = UnsignedInt1010102- | x == gl_UNSIGNED_INT_2_10_10_10_REV = UnsignedInt2101010Rev- | x == gl_UNSIGNED_INT_24_8 = UnsignedInt248- | x == gl_UNSIGNED_INT_10F_11F_11F_REV = UnsignedInt10f11f11fRev- | x == gl_UNSIGNED_INT_5_9_9_9_REV = UnsignedInt5999Rev- | x == gl_FLOAT_32_UNSIGNED_INT_24_8_REV = Float32UnsignedInt248Rev- | x == gl_BITMAP = Bitmap- | x == gl_UNSIGNED_SHORT_8_8_APPLE = UnsignedShort88- | x == gl_UNSIGNED_SHORT_8_8_REV_APPLE = UnsignedShort88Rev- | x == gl_DOUBLE = Double- | x == gl_2_BYTES = TwoBytes- | x == gl_3_BYTES = ThreeBytes- | x == gl_4_BYTES = FourBytes+ | x == GL_UNSIGNED_BYTE = UnsignedByte+ | x == GL_BYTE = Byte+ | x == GL_UNSIGNED_SHORT = UnsignedShort+ | x == GL_SHORT = Short+ | x == GL_UNSIGNED_INT = UnsignedInt+ | x == GL_INT = Int+ | x == GL_HALF_FLOAT = HalfFloat+ | x == GL_FLOAT = Float+ | x == GL_UNSIGNED_BYTE_3_3_2 = UnsignedByte332+ | x == GL_UNSIGNED_BYTE_2_3_3_REV = UnsignedByte233Rev+ | x == GL_UNSIGNED_SHORT_5_6_5 = UnsignedShort565+ | x == GL_UNSIGNED_SHORT_5_6_5_REV = UnsignedShort565Rev+ | x == GL_UNSIGNED_SHORT_4_4_4_4 = UnsignedShort4444+ | x == GL_UNSIGNED_SHORT_4_4_4_4_REV = UnsignedShort4444Rev+ | x == GL_UNSIGNED_SHORT_5_5_5_1 = UnsignedShort5551+ | x == GL_UNSIGNED_SHORT_1_5_5_5_REV = UnsignedShort1555Rev+ | x == GL_UNSIGNED_INT_8_8_8_8 = UnsignedInt8888+ | x == GL_UNSIGNED_INT_8_8_8_8_REV = UnsignedInt8888Rev+ | x == GL_UNSIGNED_INT_10_10_10_2 = UnsignedInt1010102+ | x == GL_UNSIGNED_INT_2_10_10_10_REV = UnsignedInt2101010Rev+ | x == GL_UNSIGNED_INT_24_8 = UnsignedInt248+ | x == GL_UNSIGNED_INT_10F_11F_11F_REV = UnsignedInt10f11f11fRev+ | x == GL_UNSIGNED_INT_5_9_9_9_REV = UnsignedInt5999Rev+ | x == GL_FLOAT_32_UNSIGNED_INT_24_8_REV = Float32UnsignedInt248Rev+ | x == GL_BITMAP = Bitmap+ | x == GL_UNSIGNED_SHORT_8_8_APPLE = UnsignedShort88+ | x == GL_UNSIGNED_SHORT_8_8_REV_APPLE = UnsignedShort88Rev+ | x == GL_DOUBLE = Double+ | x == GL_2_BYTES = TwoBytes+ | x == GL_3_BYTES = ThreeBytes+ | x == GL_4_BYTES = FourBytes | otherwise = error ("unmarshalDataType: illegal value " ++ show x) -data DataTypeType- = TNone- | TSignedNormalized- | TUnsignedNormalized- | TFloat- | TInt- | TUnsignedInt--marshalDataTypeType :: DataTypeType -> GLenum-marshalDataTypeType x = case x of- TNone -> gl_NONE- TSignedNormalized -> gl_SIGNED_NORMALIZED- TUnsignedNormalized -> gl_UNSIGNED_NORMALIZED- TFloat -> gl_FLOAT- TInt -> gl_INT- TUnsignedInt -> gl_UNSIGNED_INT+data DataRepresentation+ = SignedNormalizedRepresentation+ | UnsignedNormalizedRepresentation+ | FloatRepresentation+ | IntRepresentation+ | UnsignedIntRepresentation+ deriving ( Eq, Ord, Show ) -unmarshalDataTypeType :: GLenum -> DataTypeType-unmarshalDataTypeType x- | x == gl_NONE = TNone- | x == gl_SIGNED_NORMALIZED = TSignedNormalized- | x == gl_UNSIGNED_NORMALIZED = TUnsignedNormalized- | x == gl_FLOAT = TFloat- | x == gl_INT = TInt- | x == gl_UNSIGNED_INT = TUnsignedInt- | otherwise = error $ "unmarshalDataTypeType: illegal value " ++ show x+unmarshalDataRepresentation :: GLenum -> Maybe DataRepresentation+unmarshalDataRepresentation x+ | x == GL_SIGNED_NORMALIZED = Just SignedNormalizedRepresentation+ | x == GL_UNSIGNED_NORMALIZED = Just UnsignedNormalizedRepresentation+ | x == GL_FLOAT = Just FloatRepresentation+ | x == GL_INT = Just IntRepresentation+ | x == GL_UNSIGNED_INT = Just UnsignedIntRepresentation+ | x == GL_NONE = Nothing+ | otherwise = error $ "unmarshalDataRepresentation: illegal value " ++ show x
src/Graphics/Rendering/OpenGL/GL/DebugOutput.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.DebugOutput--- Copyright : (c) Sven Panne 2015+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ module Graphics.Rendering.OpenGL.GL.DebugOutput ( -- * Debug Messages debugOutput, DebugMessage(..), DebugSource(..), DebugType(..),- DebugMessageID(..), DebugSeverity(..), maxDebugMessageLength,+ DebugMessageID(DebugMessageID), DebugSeverity(..), maxDebugMessageLength, -- * Debug Message Callback debugMessageCallback,@@ -25,7 +25,8 @@ -- * Debug Message Log maxDebugLoggedMessages, debugLoggedMessages, - -- * Controlling Debug Messages (TODO)+ -- * Controlling Debug Messages+ MessageGroup(..), debugMessageControl, -- * Externally Generated Messages debugMessageInsert,@@ -34,25 +35,25 @@ DebugGroup(..), pushDebugGroup, popDebugGroup, withDebugGroup, maxDebugGroupStackDepth, - -- * Debug Labels (TODO)+ -- * Debug Labels+ CanBeLabeled(..), maxLabelLength, -- * Asynchronous and Synchronous Debug Output debugOutputSynchronous ) where import Control.Monad ( unless, replicateM )+import Data.StateVar import Foreign.C.String ( peekCStringLen, withCStringLen )-import Foreign.C.Types import Foreign.Marshal.Alloc ( alloca )-import Foreign.Marshal.Array ( allocaArray )+import Foreign.Marshal.Array ( allocaArray, withArrayLen ) import Foreign.Ptr (- Ptr, nullPtr, castPtrToFunPtr, FunPtr, nullFunPtr, freeHaskellFunPtr )+ nullPtr, castPtrToFunPtr, FunPtr, nullFunPtr, freeHaskellFunPtr ) import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -78,21 +79,21 @@ marshalDebugSource :: DebugSource -> GLenum marshalDebugSource x = case x of- DebugSourceAPI -> gl_DEBUG_SOURCE_API- DebugSourceShaderCompiler -> gl_DEBUG_SOURCE_SHADER_COMPILER- DebugSourceWindowSystem -> gl_DEBUG_SOURCE_WINDOW_SYSTEM- DebugSourceThirdParty -> gl_DEBUG_SOURCE_THIRD_PARTY- DebugSourceApplication -> gl_DEBUG_SOURCE_APPLICATION- DebugSourceOther -> gl_DEBUG_SOURCE_OTHER+ DebugSourceAPI -> GL_DEBUG_SOURCE_API+ DebugSourceShaderCompiler -> GL_DEBUG_SOURCE_SHADER_COMPILER+ DebugSourceWindowSystem -> GL_DEBUG_SOURCE_WINDOW_SYSTEM+ DebugSourceThirdParty -> GL_DEBUG_SOURCE_THIRD_PARTY+ DebugSourceApplication -> GL_DEBUG_SOURCE_APPLICATION+ DebugSourceOther -> GL_DEBUG_SOURCE_OTHER unmarshalDebugSource :: GLenum -> DebugSource unmarshalDebugSource x- | x == gl_DEBUG_SOURCE_API = DebugSourceAPI- | x == gl_DEBUG_SOURCE_SHADER_COMPILER = DebugSourceShaderCompiler- | x == gl_DEBUG_SOURCE_WINDOW_SYSTEM = DebugSourceWindowSystem- | x == gl_DEBUG_SOURCE_THIRD_PARTY = DebugSourceThirdParty- | x == gl_DEBUG_SOURCE_APPLICATION = DebugSourceApplication- | x == gl_DEBUG_SOURCE_OTHER = DebugSourceOther+ | x == GL_DEBUG_SOURCE_API = DebugSourceAPI+ | x == GL_DEBUG_SOURCE_SHADER_COMPILER = DebugSourceShaderCompiler+ | x == GL_DEBUG_SOURCE_WINDOW_SYSTEM = DebugSourceWindowSystem+ | x == GL_DEBUG_SOURCE_THIRD_PARTY = DebugSourceThirdParty+ | x == GL_DEBUG_SOURCE_APPLICATION = DebugSourceApplication+ | x == GL_DEBUG_SOURCE_OTHER = DebugSourceOther | otherwise = error ("unmarshalDebugSource: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -111,27 +112,27 @@ marshalDebugType :: DebugType -> GLenum marshalDebugType x = case x of- DebugTypeError -> gl_DEBUG_TYPE_ERROR- DebugTypeDeprecatedBehavior -> gl_DEBUG_TYPE_DEPRECATED_BEHAVIOR- DebugTypeUndefinedBehavior -> gl_DEBUG_TYPE_UNDEFINED_BEHAVIOR- DebugTypePerformance -> gl_DEBUG_TYPE_PERFORMANCE- DebugTypePortability -> gl_DEBUG_TYPE_PORTABILITY- DebugTypeMarker -> gl_DEBUG_TYPE_MARKER- DebugTypePushGroup -> gl_DEBUG_TYPE_PUSH_GROUP- DebugTypePopGroup -> gl_DEBUG_TYPE_POP_GROUP- DebugTypeOther -> gl_DEBUG_TYPE_OTHER+ DebugTypeError -> GL_DEBUG_TYPE_ERROR+ DebugTypeDeprecatedBehavior -> GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR+ DebugTypeUndefinedBehavior -> GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR+ DebugTypePerformance -> GL_DEBUG_TYPE_PERFORMANCE+ DebugTypePortability -> GL_DEBUG_TYPE_PORTABILITY+ DebugTypeMarker -> GL_DEBUG_TYPE_MARKER+ DebugTypePushGroup -> GL_DEBUG_TYPE_PUSH_GROUP+ DebugTypePopGroup -> GL_DEBUG_TYPE_POP_GROUP+ DebugTypeOther -> GL_DEBUG_TYPE_OTHER unmarshalDebugType :: GLenum -> DebugType unmarshalDebugType x- | x == gl_DEBUG_TYPE_ERROR = DebugTypeError- | x == gl_DEBUG_TYPE_DEPRECATED_BEHAVIOR = DebugTypeDeprecatedBehavior- | x == gl_DEBUG_TYPE_UNDEFINED_BEHAVIOR = DebugTypeUndefinedBehavior- | x == gl_DEBUG_TYPE_PERFORMANCE = DebugTypePerformance- | x == gl_DEBUG_TYPE_PORTABILITY = DebugTypePortability- | x == gl_DEBUG_TYPE_MARKER = DebugTypeMarker- | x == gl_DEBUG_TYPE_PUSH_GROUP = DebugTypePushGroup- | x == gl_DEBUG_TYPE_POP_GROUP = DebugTypePopGroup- | x == gl_DEBUG_TYPE_OTHER = DebugTypeOther+ | x == GL_DEBUG_TYPE_ERROR = DebugTypeError+ | x == GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = DebugTypeDeprecatedBehavior+ | x == GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = DebugTypeUndefinedBehavior+ | x == GL_DEBUG_TYPE_PERFORMANCE = DebugTypePerformance+ | x == GL_DEBUG_TYPE_PORTABILITY = DebugTypePortability+ | x == GL_DEBUG_TYPE_MARKER = DebugTypeMarker+ | x == GL_DEBUG_TYPE_PUSH_GROUP = DebugTypePushGroup+ | x == GL_DEBUG_TYPE_POP_GROUP = DebugTypePopGroup+ | x == GL_DEBUG_TYPE_OTHER = DebugTypeOther | otherwise = error ("unmarshalDebugType: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -150,17 +151,17 @@ marshalDebugSeverity :: DebugSeverity -> GLenum marshalDebugSeverity x = case x of- DebugSeverityHigh -> gl_DEBUG_SEVERITY_HIGH- DebugSeverityMedium -> gl_DEBUG_SEVERITY_MEDIUM- DebugSeverityLow -> gl_DEBUG_SEVERITY_LOW- DebugSeverityNotification -> gl_DEBUG_SEVERITY_NOTIFICATION+ DebugSeverityHigh -> GL_DEBUG_SEVERITY_HIGH+ DebugSeverityMedium -> GL_DEBUG_SEVERITY_MEDIUM+ DebugSeverityLow -> GL_DEBUG_SEVERITY_LOW+ DebugSeverityNotification -> GL_DEBUG_SEVERITY_NOTIFICATION unmarshalDebugSeverity :: GLenum -> DebugSeverity unmarshalDebugSeverity x- | x == gl_DEBUG_SEVERITY_HIGH = DebugSeverityHigh- | x == gl_DEBUG_SEVERITY_MEDIUM = DebugSeverityMedium- | x == gl_DEBUG_SEVERITY_LOW = DebugSeverityLow- | x == gl_DEBUG_SEVERITY_NOTIFICATION = DebugSeverityNotification+ | x == GL_DEBUG_SEVERITY_HIGH = DebugSeverityHigh+ | x == GL_DEBUG_SEVERITY_MEDIUM = DebugSeverityMedium+ | x == GL_DEBUG_SEVERITY_LOW = DebugSeverityLow+ | x == GL_DEBUG_SEVERITY_NOTIFICATION = DebugSeverityNotification | otherwise = error ("unmarshalDebugSeverity: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -177,7 +178,7 @@ getDebugMessageCallback :: IO (Maybe (DebugMessage -> IO ())) getDebugMessageCallback = do- cb <- castPtrToFunPtr `fmap` getPointer DebugCallbackFunction+ cb <- getDebugCallbackFunction return $ if (cb == nullFunPtr) then Nothing else Just . toDebugProc . dyn_debugProc $ cb@@ -198,7 +199,7 @@ setDebugMessageCallback :: Maybe (DebugMessage -> IO ()) -> IO () setDebugMessageCallback maybeDebugProc = do- oldCB <- castPtrToFunPtr `fmap` getPointer DebugCallbackFunction+ oldCB <- getDebugCallbackFunction unless (oldCB == nullFunPtr) $ freeHaskellFunPtr oldCB newCB <-@@ -214,6 +215,10 @@ (unmarshalDebugSeverity severity) msg) +getDebugCallbackFunction :: IO (FunPtr GLDEBUGPROCFunc)+getDebugCallbackFunction =+ castPtrToFunPtr `fmap` getPointer DebugCallbackFunction+ -------------------------------------------------------------------------------- maxDebugLoggedMessages :: GettableStateVar GLsizei@@ -233,8 +238,8 @@ alloca $ \idBuf -> alloca $ \severityBuf -> allocaArray (fromIntegral len) $ \messageBuf -> do- glGetDebugMessageLog 1 len sourceBuf typeBuf idBuf severityBuf- nullPtr messageBuf+ _ <- glGetDebugMessageLog 1 len sourceBuf typeBuf idBuf+ severityBuf nullPtr messageBuf source <- peek1 unmarshalDebugSource sourceBuf typ <- peek1 unmarshalDebugType typeBuf msgID <- peek1 DebugMessageID idBuf@@ -244,6 +249,35 @@ -------------------------------------------------------------------------------- +data MessageGroup =+ MessageGroup (Maybe DebugSource) (Maybe DebugType) (Maybe DebugSeverity)+ | MessageGroupWithIDs DebugSource DebugType [DebugMessageID]+ deriving ( Eq, Ord, Show )++debugMessageControl :: MessageGroup -> SettableStateVar Capability+debugMessageControl x = case x of+ MessageGroup maybeSource maybeType maybeSeverity ->+ doDebugMessageControl maybeSource maybeType maybeSeverity []+ MessageGroupWithIDs source typ messageIDs ->+ doDebugMessageControl (Just source) (Just typ) Nothing messageIDs++doDebugMessageControl :: Maybe DebugSource+ -> Maybe DebugType+ -> Maybe DebugSeverity+ -> [DebugMessageID]+ -> SettableStateVar Capability+doDebugMessageControl maybeSource maybeType maybeSeverity messageIDs =+ makeSettableStateVar $ \cap ->+ withArrayLen (map debugMessageID messageIDs) $ \len idsBuf ->+ glDebugMessageControl (maybe GL_DONT_CARE marshalDebugSource maybeSource)+ (maybe GL_DONT_CARE marshalDebugType maybeType)+ (maybe GL_DONT_CARE marshalDebugSeverity maybeSeverity)+ (fromIntegral len)+ idsBuf+ (marshalCapability cap)++--------------------------------------------------------------------------------+ debugMessageInsert :: DebugMessage -> IO () debugMessageInsert (DebugMessage source typ msgID severity message) = withCStringLen message $ \(msg, len) ->@@ -276,6 +310,16 @@ maxDebugGroupStackDepth :: GettableStateVar GLsizei maxDebugGroupStackDepth = makeGettableStateVar (getSizei1 id GetMaxDebugGroupStackDepth)++--------------------------------------------------------------------------------++-- TODO: Make instances for the following features when we have them:+-- * PROGRAM_PIPELINE / glGenProgramPipelines+-- * SAMPLER / glGenSamplers+-- * TRANSFORM_FEEDBACK / glGenTransformFeedbacks++class CanBeLabeled a where+ objectLabel :: a -> StateVar (Maybe String) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/DisplayLists.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.DisplayLists--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,15 +22,17 @@ callList, callLists, listBase ) where -import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.GL.StateVar+import Control.Monad.IO.Class+import Data.ObjectName+import Data.StateVar+import Foreign.Ptr ( Ptr )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.DataType import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -38,9 +40,13 @@ deriving ( Eq, Ord, Show ) instance ObjectName DisplayList where- isObjectName = fmap unmarshalGLboolean . glIsList . displayListID- deleteObjectNames = mapM_ (uncurry glDeleteLists) . combineConsecutive+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsList . displayListID+ deleteObjectNames =+ liftIO . mapM_ (uncurry glDeleteLists) . combineConsecutive +instance CanBeLabeled DisplayList where+ objectLabel = objectNameLabel GL_DISPLAY_LIST . displayListID+ combineConsecutive :: [DisplayList] -> [(GLuint, GLsizei)] combineConsecutive [] = [] combineConsecutive (z:zs) = (displayListID z, len) : combineConsecutive rest@@ -53,12 +59,13 @@ DisplayList x `isFollowedBy` DisplayList y = x + 1 == y instance GeneratableObjectName DisplayList where- genObjectNames n = do+ genObjectNames n = liftIO $ do first <- glGenLists (fromIntegral n) if DisplayList first == noDisplayList then do recordOutOfMemory return []- else return [ DisplayList l | l <- [ first .. first + fromIntegral n - 1 ] ]+ else return [ DisplayList l+ | l <- [ first .. first + fromIntegral n - 1 ] ] -------------------------------------------------------------------------------- @@ -69,13 +76,13 @@ marshalListMode :: ListMode -> GLenum marshalListMode x = case x of- Compile -> gl_COMPILE- CompileAndExecute -> gl_COMPILE_AND_EXECUTE+ Compile -> GL_COMPILE+ CompileAndExecute -> GL_COMPILE_AND_EXECUTE unmarshalListMode :: GLenum -> ListMode unmarshalListMode x- | x == gl_COMPILE = Compile- | x == gl_COMPILE_AND_EXECUTE = CompileAndExecute+ | x == GL_COMPILE = Compile+ | x == GL_COMPILE_AND_EXECUTE = CompileAndExecute | otherwise = error ("unmarshalListMode: illegal value " ++ show x) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Domain.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Domain--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,7 +22,7 @@ import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/EdgeFlag.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.EdgeFlag--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ ) where import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Evaluators.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Evaluators--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -46,6 +46,7 @@ import Control.Monad import Data.List+import Data.StateVar import Foreign.ForeignPtr import Foreign.Marshal.Array import Foreign.Marshal.Utils@@ -57,9 +58,8 @@ import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.PolygonMode import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexArrays-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -74,11 +74,11 @@ MapDescriptor (d, d) Stride Order NumComponents deriving ( Eq, Ord, Show ) -totalComponents1 :: Domain d => MapDescriptor d -> Int+totalComponents1 :: MapDescriptor d -> Int totalComponents1 (MapDescriptor _ stride order numComp) = fromIntegral stride * (fromIntegral order - 1) + fromIntegral numComp -totalComponents2 :: Domain d => MapDescriptor d -> MapDescriptor d -> Int+totalComponents2 :: MapDescriptor d -> MapDescriptor d -> Int totalComponents2 uDescriptor vDescriptor@(MapDescriptor _ _ _ numComp) = totalComponents1 uDescriptor + totalComponents1 vDescriptor - fromIntegral numComp @@ -323,9 +323,9 @@ marshalGetMapQuery :: GetMapQuery -> GLenum marshalGetMapQuery x = case x of- Coeff -> gl_COEFF- Order -> gl_ORDER- Domain -> gl_DOMAIN+ Coeff -> GL_COEFF+ Order -> GL_ORDER+ Domain -> GL_DOMAIN --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Exception.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Exception--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/Face.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Face--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ Face(..), marshalFace, unmarshalFace ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -29,13 +29,13 @@ marshalFace :: Face -> GLenum marshalFace x = case x of- Front -> gl_FRONT- Back -> gl_BACK- FrontAndBack -> gl_FRONT_AND_BACK+ Front -> GL_FRONT+ Back -> GL_BACK+ FrontAndBack -> GL_FRONT_AND_BACK unmarshalFace :: GLenum -> Face unmarshalFace x- | x == gl_FRONT = Front- | x == gl_BACK = Back- | x == gl_FRONT_AND_BACK = FrontAndBack+ | x == GL_FRONT = Front+ | x == GL_BACK = Back+ | x == GL_FRONT_AND_BACK = FrontAndBack | otherwise = error ("unmarshalFace: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/Feedback.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Feedback--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,15 +18,15 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.IOState import Graphics.Rendering.OpenGL.GL.RenderMode-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -65,14 +65,14 @@ unmarshalFeedbackTag :: GLenum -> FeedbackTag unmarshalFeedbackTag x- | x == gl_POINT_TOKEN = PointTag- | x == gl_LINE_TOKEN = LineTag- | x == gl_LINE_RESET_TOKEN = LineResetTag- | x == gl_POLYGON_TOKEN = PolygonTag- | x == gl_BITMAP_TOKEN = BitmapTag- | x == gl_DRAW_PIXEL_TOKEN = DrawPixelTag- | x == gl_COPY_PIXEL_TOKEN = CopyPixelTag- | x == gl_PASS_THROUGH_TOKEN = PassThroughTag+ | x == GL_POINT_TOKEN = PointTag+ | x == GL_LINE_TOKEN = LineTag+ | x == GL_LINE_RESET_TOKEN = LineResetTag+ | x == GL_POLYGON_TOKEN = PolygonTag+ | x == GL_BITMAP_TOKEN = BitmapTag+ | x == GL_DRAW_PIXEL_TOKEN = DrawPixelTag+ | x == GL_COPY_PIXEL_TOKEN = CopyPixelTag+ | x == GL_PASS_THROUGH_TOKEN = PassThroughTag | otherwise = error ("unmarshalFeedbackTag: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -87,11 +87,11 @@ marshalFeedbackType :: FeedbackType -> GLenum marshalFeedbackType x = case x of- TwoD -> gl_2D- ThreeD -> gl_3D- ThreeDColor -> gl_3D_COLOR- ThreeDColorTexture -> gl_3D_COLOR_TEXTURE- FourDColorTexture -> gl_4D_COLOR_TEXTURE+ TwoD -> GL_2D+ ThreeD -> GL_3D+ ThreeDColor -> GL_3D_COLOR+ ThreeDColorTexture -> GL_3D_COLOR_TEXTURE+ FourDColorTexture -> GL_4D_COLOR_TEXTURE --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/FlushFinish.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FlushFinish--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ flush, finish ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Fog.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Fog--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,13 +20,13 @@ FogDistanceMode(..), fogDistanceMode ) where +import Data.StateVar import Foreign.Marshal.Utils import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -47,14 +47,14 @@ marshalFogParameter :: FogParameter -> GLenum marshalFogParameter x = case x of- FogIndex -> gl_FOG_INDEX- FogDensity -> gl_FOG_DENSITY- FogStart -> gl_FOG_START- FogEnd -> gl_FOG_END- FogMode -> gl_FOG_MODE- FogColor -> gl_FOG_COLOR- FogCoordSrc -> gl_FOG_COORD_SRC- FogDistanceMode -> gl_FOG_DISTANCE_MODE_NV+ FogIndex -> GL_FOG_INDEX+ FogDensity -> GL_FOG_DENSITY+ FogStart -> GL_FOG_START+ FogEnd -> GL_FOG_END+ FogMode -> GL_FOG_MODE+ FogColor -> GL_FOG_COLOR+ FogCoordSrc -> GL_FOG_COORD_SRC+ FogDistanceMode -> GL_FOG_DISTANCE_MODE_NV -------------------------------------------------------------------------------- @@ -65,15 +65,15 @@ marshalFogMode' :: FogMode' -> GLint marshalFogMode' x = fromIntegral $ case x of- Linear' -> gl_LINEAR- Exp' -> gl_EXP- Exp2' -> gl_EXP2+ Linear' -> GL_LINEAR+ Exp' -> GL_EXP+ Exp2' -> GL_EXP2 unmarshalFogMode' :: GLint -> FogMode' unmarshalFogMode' x- | y == gl_LINEAR = Linear'- | y == gl_EXP = Exp'- | y == gl_EXP2 = Exp2'+ | y == GL_LINEAR = Linear'+ | y == GL_EXP = Exp'+ | y == GL_EXP2 = Exp2' | otherwise = error ("unmarshalFogMode': illegal value " ++ show x) where y = fromIntegral x @@ -149,13 +149,13 @@ marshalFogCoordSrc :: FogCoordSrc -> GLint marshalFogCoordSrc x = fromIntegral $ case x of- FogCoord -> gl_FOG_COORD- FragmentDepth -> gl_FRAGMENT_DEPTH+ FogCoord -> GL_FOG_COORD+ FragmentDepth -> GL_FRAGMENT_DEPTH unmarshalFogCoordSrc :: GLint -> FogCoordSrc unmarshalFogCoordSrc x- | y == gl_FOG_COORD = FogCoord- | y == gl_FRAGMENT_DEPTH = FragmentDepth+ | y == GL_FOG_COORD = FogCoord+ | y == GL_FRAGMENT_DEPTH = FragmentDepth | otherwise = error ("unmarshalFogCoordSrc: illegal value " ++ show x) where y = fromIntegral x @@ -177,15 +177,15 @@ marshalFogDistanceMode :: FogDistanceMode -> GLint marshalFogDistanceMode x = fromIntegral $ case x of- EyeRadial -> gl_EYE_RADIAL_NV- EyePlaneSigned ->gl_EYE_PLANE- EyePlaneAbsolute -> gl_EYE_PLANE_ABSOLUTE_NV+ EyeRadial -> GL_EYE_RADIAL_NV+ EyePlaneSigned -> GL_EYE_PLANE+ EyePlaneAbsolute -> GL_EYE_PLANE_ABSOLUTE_NV unmarshalFogDistanceMode :: GLint -> FogDistanceMode unmarshalFogDistanceMode x- | y == gl_EYE_RADIAL_NV = EyeRadial- | y == gl_EYE_PLANE = EyePlaneSigned- | y == gl_EYE_PLANE_ABSOLUTE_NV = EyePlaneAbsolute+ | y == GL_EYE_RADIAL_NV = EyeRadial+ | y == GL_EYE_PLANE = EyePlaneSigned+ | y == GL_EYE_PLANE_ABSOLUTE_NV = EyePlaneAbsolute | otherwise = error ("unmarshalFogDistanceMode: illegal value " ++ show x) where y = fromIntegral x
src/Graphics/Rendering/OpenGL/GL/Framebuffer.hs view
@@ -1,100 +1,66 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Framebuffer--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com> -- Stability : stable -- Portability : portable ----- This module corresponds to section 4.2 (Whole Framebuffer Operations) of the--- OpenGL 2.1 specs.+-- This module corresponds to section 17.4 (Whole Framebuffer Operations) of the+-- OpenGL 4.5 specs. -- -------------------------------------------------------------------------------- module Graphics.Rendering.OpenGL.GL.Framebuffer (- -- * Querying the Buffer Configuration- auxBuffers, doubleBuffer, stereoBuffer,- rgbaBits, stencilBits, depthBits, accumBits, rgbaSignedComponents,- -- * Selecting a Buffer for Writing- DrawBufferIndex, BufferMode(..), drawBuffer, drawBuffers, drawBufferi, maxDrawBuffers,+ BufferMode(..),+ drawBuffer, namedFramebufferDrawBuffer,+ drawBuffers, namedFramebufferDrawBuffers,+ DrawBufferIndex, drawBufferi,+ maxDrawBuffers, -- * Fine Control of Buffer Updates- indexMask, colorMask, colorMaski, stencilMask, stencilMaskSeparate, depthMask,+ indexMask, colorMask, colorMaski, depthMask,+ stencilMask, stencilMaskSeparate, -- * Clearing the Buffers ClearBuffer(..), clear,- clearColor, clearIndex, clearStencil, clearDepth, clearAccum,+ clearColor, clearIndex, clearDepth, clearDepthf, clearStencil, clearAccum, + ClearBufferCommand(..), clearBuffer, clearNamedFramebuffer,++ -- * Invalidating Framebuffer Contents+ invalidateSubFramebuffer, invalidateNamedFramebufferSubData,+ invalidateFramebuffer, invalidateNamedFramebufferData,+ -- * The Accumulation Buffer- AccumOp(..), accum+ AccumOp(..), accum,++ -- * Querying the Buffer Configuration+ auxBuffers, doubleBuffer, stereoBuffer,+ rgbaBits, stencilBits, depthBits, accumBits, rgbaSignedComponents, ) where import Control.Monad-import Data.List import Data.Maybe+import Data.StateVar import Foreign.Marshal.Array+import Foreign.Marshal.Utils+import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.BufferMode import Graphics.Rendering.OpenGL.GL.Capability+import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.Face+import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObject+import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjectAttachment+import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw-------------------------------------------------------------------------------------- | The implementation and context dependent number of auxiliary buffers.--auxBuffers :: GettableStateVar GLsizei-auxBuffers = makeGettableStateVar $ getSizei1 id GetAuxBuffers---- | 'True' if front and back buffers exist.--doubleBuffer :: GettableStateVar Bool-doubleBuffer =- makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetDoublebuffer---- | 'True' if left and right buffers exist.--stereoBuffer :: GettableStateVar Bool-stereoBuffer =- makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetStereo--rgbaBits :: GettableStateVar (Color4 GLsizei)-rgbaBits =- makeGettableStateVar $- liftM4 Color4 (getSizei1 id GetRedBits)- (getSizei1 id GetGreenBits)- (getSizei1 id GetBlueBits)- (getSizei1 id GetAlphaBits)--stencilBits :: GettableStateVar GLsizei-stencilBits = makeGettableStateVar $ getSizei1 id GetStencilBits--depthBits :: GettableStateVar GLsizei-depthBits = makeGettableStateVar $ getSizei1 id GetDepthBits--accumBits :: GettableStateVar (Color4 GLsizei)-accumBits =- makeGettableStateVar $- liftM4 Color4 (getSizei1 id GetAccumRedBits)- (getSizei1 id GetAccumGreenBits)- (getSizei1 id GetAccumBlueBits)- (getSizei1 id GetAccumAlphaBits)--rgbaSignedComponents :: GettableStateVar (Color4 Bool)-rgbaSignedComponents =- makeGettableStateVar $- getInteger4 (\r g b a -> Color4 (unmarshalGLboolean r)- (unmarshalGLboolean g)- (unmarshalGLboolean b)- (unmarshalGLboolean a))- GetRGBASignedComponents+import Graphics.GL -------------------------------------------------------------------------------- @@ -114,15 +80,24 @@ -- 'BackBuffers' for double-buffered contexts. drawBuffer :: StateVar BufferMode-drawBuffer =- makeStateVar- (getEnum1 unmarshalBufferMode GetDrawBuffer)- (maybe recordInvalidValue glDrawBuffer . marshalBufferMode)+drawBuffer = makeStateVar getDrawBuffer setDrawBuffer ---------------------------------------------------------------------------------+getDrawBuffer :: IO BufferMode+getDrawBuffer = getDrawBufferi 0 -type DrawBufferIndex = GLuint+setDrawBuffer :: BufferMode -> IO ()+setDrawBuffer mode =+ withBufferModes [mode] $ \[m] ->+ glDrawBuffer m +-- | The direct-state-access version of 'drawBuffer'.++namedFramebufferDrawBuffer :: FramebufferObject -> SettableStateVar BufferMode+namedFramebufferDrawBuffer fbo =+ makeSettableStateVar $ \mode ->+ withBufferModes [mode] $ \[m] ->+ glNamedFramebufferDrawBuffer (framebufferID fbo) m+ -- | 'drawBuffers' defines the draw buffers to which all fragment colors are -- written. The draw buffers being defined correspond in order to the respective -- fragment colors. The draw buffer for fragment colors beyond those specified@@ -150,26 +125,44 @@ getDrawBuffers :: IO [BufferMode] getDrawBuffers = do n <- get maxDrawBuffers- mapM (getEnum1 unmarshalBufferMode . GetDrawBufferN) [ 0 .. n ]+ mapM getDrawBufferi [ 0 .. n-1 ] setDrawBuffers :: [BufferMode] -> IO ()-setDrawBuffers modes = do- let ms = map marshalBufferMode modes- if all isJust ms- then withArray (map fromJust ms) $- glDrawBuffers (genericLength ms)- else recordInvalidValue+setDrawBuffers modes =+ withBufferModes modes $ \ms ->+ withArrayLen ms $ \len ->+ glDrawBuffers (fromIntegral len) --- | 'drawBufferi' is a fast query function. For indices in the range 0..maxDrawBuffers it's results--- are the same as selection the index from the list returned by drawBuffers. Though this function--- only uses one gl-function call instead of maxDrawBuffers + 1.-drawBufferi :: DrawBufferIndex -> GettableStateVar BufferMode-drawBufferi ind = makeGettableStateVar- (getEnum1 unmarshalBufferMode . GetDrawBufferN $ fromIntegral ind)+-- | The direct-state-access version of 'drawBuffers'. +namedFramebufferDrawBuffers :: FramebufferObject -> SettableStateVar [BufferMode]+namedFramebufferDrawBuffers fbo =+ makeSettableStateVar $ \modes ->+ withBufferModes modes $ \ms ->+ withArrayLen ms $ \len ->+ glNamedFramebufferDrawBuffers (framebufferID fbo) (fromIntegral len) ---------------------------------------------------------------------------------+withBufferModes :: [BufferMode] -> ([GLenum] -> IO ()) -> IO ()+withBufferModes modes success+ | all isJust ms = success (catMaybes ms)+ | otherwise = recordInvalidValue+ where ms = map marshalBufferMode modes +-- | The index of the draw buffer.++type DrawBufferIndex = GLuint++-- | 'drawBufferi' is a fast query function. For indices in the range+-- 0..'maxDrawBuffers'-1 its results is the same as selecting the corresponding+-- element from the list returned by 'drawBuffers', but this function uses only+-- one GL function call instead of 'maxDrawBuffers' ones.++drawBufferi :: DrawBufferIndex -> GettableStateVar BufferMode+drawBufferi = makeGettableStateVar . getDrawBufferi . fromIntegral++getDrawBufferi :: GLsizei -> IO BufferMode+getDrawBufferi = getEnum1 unmarshalBufferMode . GetDrawBufferN+ -- | Contains the maximum number of buffers that can activated via 'drawBuffers' -- or which can be simultaneously written into from within a fragment shader -- using the special output variable array @gl_FragData@. This constant@@ -183,7 +176,7 @@ -- | Controls the writing of individual bits in the color index buffers. The -- least significant /n/ bits of its value, where /n/ is the number of bits in a--- color index buffer, specify a mask. Where a 1 appears in the mask, it is+-- color index buffer, specify a mask. Where a 1 appears in the mask, it is -- possible to write to the corresponding bit in the color index buffer (or -- buffers). Where a 0 appears, the corresponding bit is write-protected. --@@ -195,8 +188,6 @@ indexMask = makeStateVar (getInteger1 fromIntegral GetIndexWritemask) glIndexMask ---------------------------------------------------------------------------------- -- | Controls whether the individual color components in the framebuffer can or -- cannot be written. If the red flag is 'Disabled', for example, no change is -- made to the red component of any pixel in any of the color buffers,@@ -214,25 +205,28 @@ (unmarshalCapability g) (unmarshalCapability b) (unmarshalCapability a))- GetColorWritemask)+ GetColorWritemask) (\(Color4 r g b a) -> glColorMask (marshalCapability r) (marshalCapability g) (marshalCapability b) (marshalCapability a))--- | 'colorMaski' is a version of 'colorMask' that only applies to the specified drawbuffer++-- | 'colorMaski' is a version of 'colorMask' that only applies to the specified+-- draw buffer.+ colorMaski :: DrawBufferIndex -> StateVar (Color4 Capability)-colorMaski x = makeStateVar+colorMaski idx =+ makeStateVar (getBoolean4i (\r g b a -> Color4 (unmarshalCapability r)- (unmarshalCapability g)- (unmarshalCapability b)- (unmarshalCapability a))- GetColorWritemask x)- (\(Color4 r g b a) -> glColorMaski (x) (marshalCapability r)- (marshalCapability g)- (marshalCapability b)- (marshalCapability a))----------------------------------------------------------------------------------+ (unmarshalCapability g)+ (unmarshalCapability b)+ (unmarshalCapability a))+ GetColorWritemask idx)+ (\(Color4 r g b a) -> glColorMaski idx+ (marshalCapability r)+ (marshalCapability g)+ (marshalCapability b)+ (marshalCapability a)) -- | Controls whether the depth buffer is enabled for writing. The initial state -- is 'Enabled'.@@ -241,23 +235,27 @@ depthMask = makeStateVar (getBoolean1 unmarshalCapability GetDepthWritemask) (glDepthMask . marshalCapability) ---------------------------------------------------------------------------------- -- | Controls the writing of individual bits in the stencil planes. The least -- significant /n/ bits of its value, where /n/ is the number of bits in the--- stencil buffer, specify a mask. Where a 1 appears in the mask, it is--- possible to write to the corresponding bit in the stencil buffer. Where a 0--- appears, the corresponding bit is write-protected.--- Initially, all bits are enabled for writing.+-- stencil buffer, specify a mask. Where a 1 appears in the mask, it is possible+-- to write to the corresponding bit in the stencil buffer. Where a 0 appears,+-- the corresponding bit is write-protected. Initially, all bits are enabled for+-- writing. stencilMask :: StateVar GLuint stencilMask =- makeStateVar (getInteger1 fromIntegral GetStencilWritemask) glStencilMask+ makeStateVar (get (stencilMaskSeparate Front)) glStencilMask -stencilMaskSeparate :: Face -> SettableStateVar GLuint+-- | A per-face version of 'stencilMask'.++stencilMaskSeparate :: Face -> StateVar GLuint stencilMaskSeparate face =- makeSettableStateVar $- glStencilMaskSeparate (marshalFace face)+ makeStateVar+ (case face of+ Front -> getInteger1 fromIntegral GetStencilWritemask+ Back -> getInteger1 fromIntegral GetStencilBackWritemask+ FrontAndBack -> do recordInvalidEnum; return 0)+ (glStencilMaskSeparate (marshalFace face)) -------------------------------------------------------------------------------- @@ -272,12 +270,10 @@ marshalClearBuffer :: ClearBuffer -> GLbitfield marshalClearBuffer x = case x of- ColorBuffer -> gl_COLOR_BUFFER_BIT- AccumBuffer -> gl_ACCUM_BUFFER_BIT- StencilBuffer -> gl_STENCIL_BUFFER_BIT- DepthBuffer -> gl_DEPTH_BUFFER_BIT----------------------------------------------------------------------------------+ ColorBuffer -> GL_COLOR_BUFFER_BIT+ AccumBuffer -> GL_ACCUM_BUFFER_BIT+ StencilBuffer -> GL_STENCIL_BUFFER_BIT+ DepthBuffer -> GL_DEPTH_BUFFER_BIT -- | Set the bitplane area of the window to values previously selected by -- 'clearColor', 'clearIndex', 'clearDepth', 'clearStencil', and 'clearAccum'.@@ -299,18 +295,13 @@ clear :: [ClearBuffer] -> IO () clear = glClear . sum . map marshalClearBuffer ---------------------------------------------------------------------------------- -- | Controls the red, green, blue, and alpha values used by 'clear' to clear--- the color buffers. Values written into 'clearColor' are clamped to the range--- [0, 1]. Initially, all values are 0.+-- the color buffers. Initially, all values are 0. -clearColor :: StateVar (Color4 GLclampf)-clearColor = makeStateVar (getClampf4 Color4 GetColorClearValue)+clearColor :: StateVar (Color4 GLfloat)+clearColor = makeStateVar (getFloat4 Color4 GetColorClearValue) (\(Color4 r g b a) -> glClearColor r g b a) ---------------------------------------------------------------------------------- -- | Controls the index /c/ used by 'clear' to clear the color index buffers. -- /c/ is not clamped. Rather, /c/ is converted to a fixed-point value with -- unspecified precision to the right of the binary point. The integer part of@@ -321,16 +312,16 @@ clearIndex = makeStateVar (getFloat1 Index1 GetIndexClearValue) (\(Index1 i) -> glClearIndex i) ---------------------------------------------------------------------------------+-- | Controls the depth value used by 'clear' to clear the depth buffer. The+-- initial value is 1. --- | Controls the depth value used by 'clear' to clear the depth buffer. Values--- written into 'clearDepth' are clamped to the range [0, 1]. The initial value--- is 1.+clearDepth :: StateVar GLdouble+clearDepth = makeStateVar (getDouble1 id GetDepthClearValue) glClearDepth -clearDepth :: StateVar GLclampd-clearDepth = makeStateVar (getClampd1 id GetDepthClearValue) glClearDepth+-- | A variant of 'clearDepth' with a 'GLfloat' argument. ---------------------------------------------------------------------------------+clearDepthf :: StateVar GLfloat+clearDepthf = makeStateVar (getFloat1 id GetDepthClearValue) glClearDepthf -- | Controls the value /s/ used by 'clear' to clear the stencil buffer. /s/ is -- masked with 2^/m/-1, where /m/ is the number of bits in the stencil buffer.@@ -339,8 +330,6 @@ clearStencil :: StateVar GLint clearStencil = makeStateVar (getInteger1 id GetStencilClearValue) glClearStencil ---------------------------------------------------------------------------------- -- | Controls the red, green, blue, and alpha values used by 'clear' to clear -- the accumulation buffer. Values written into 'clearAccum' are clamped to the -- range [-1, 1]. The initial values are all 0.@@ -350,8 +339,147 @@ makeStateVar (getFloat4 Color4 GetAccumClearValue) (\(Color4 r g b a) -> glClearAccum r g b a) +-- | Describes which buffer(s) to clear and the value to use.++data ClearBufferCommand+ = ClearColorBufferInt DrawBufferIndex (Color4 GLint)+ -- ^ Clear the signed integer color buffer(s) at the given index.+ | ClearColorBufferFloat DrawBufferIndex (Color4 GLfloat)+ -- ^ Clear the fixed- or floating-point color buffer(s) at the given index.+ | ClearColorBufferUint DrawBufferIndex (Color4 GLuint)+ -- ^ Clear the unsigned color buffer(s) at the given index.+ | ClearDepthBuffer GLfloat+ -- ^ Clear the depth buffer.+ | ClearStencilBuffer GLint+ -- ^ Clear the stencil buffer.+ | ClearDepthAndStencilBuffers GLfloat GLint+ -- ^ Clear the depth buffer and the stencil buffer.+ deriving ( Eq, Ord, Show )++-- | Clear the given buffer(s).++clearBuffer :: ClearBufferCommand -> IO ()+clearBuffer cmd = case cmd of+ ClearColorBufferInt i c ->+ with c $ glClearBufferiv GL_COLOR (fromIntegral i) . castPtr+ ClearColorBufferFloat i c ->+ with c $ glClearBufferfv GL_COLOR (fromIntegral i) . castPtr+ ClearColorBufferUint i c ->+ with c $ glClearBufferuiv GL_COLOR (fromIntegral i) . castPtr+ ClearDepthBuffer d ->+ with d $ glClearBufferfv GL_DEPTH 0+ ClearStencilBuffer s ->+ with s $ glClearBufferiv GL_STENCIL 0+ ClearDepthAndStencilBuffers d s ->+ glClearBufferfi GL_DEPTH_STENCIL 0 d s++-- | The direct-state-access version of 'clearBuffer'.++clearNamedFramebuffer :: FramebufferObject -> ClearBufferCommand -> IO ()+clearNamedFramebuffer fbo cmd = case cmd of+ ClearColorBufferInt i c ->+ with c $ glClearNamedFramebufferiv f GL_COLOR (fromIntegral i) . castPtr+ ClearColorBufferFloat i c ->+ with c $ glClearNamedFramebufferfv f GL_COLOR (fromIntegral i) . castPtr+ ClearColorBufferUint i c ->+ with c $ glClearNamedFramebufferuiv f GL_COLOR (fromIntegral i) . castPtr+ ClearDepthBuffer d ->+ with d $ glClearNamedFramebufferfv f GL_DEPTH 0+ ClearStencilBuffer s ->+ with s $ glClearNamedFramebufferiv f GL_STENCIL 0+ ClearDepthAndStencilBuffers d s ->+ glClearNamedFramebufferfi f GL_DEPTH_STENCIL 0 d s+ where f = framebufferID fbo+ -------------------------------------------------------------------------------- +-- | Invalidate a region of the attachments bound to the given target.++invalidateSubFramebuffer :: FramebufferTarget -> [FramebufferObjectAttachment] -> (Position, Size) -> IO ()+invalidateSubFramebuffer target attachments (Position x y, Size w h) =+ withAttachments attachments $ \numAttachments atts ->+ glInvalidateSubFramebuffer (marshalFramebufferTarget target) numAttachments atts x y w h++-- | The direct-state-access version of 'invalidateSubFramebuffer'.++invalidateNamedFramebufferSubData :: FramebufferObject -> [FramebufferObjectAttachment] -> (Position, Size) -> IO ()+invalidateNamedFramebufferSubData fbo attachments (Position x y, Size w h) =+ withAttachments attachments $ \numAttachments atts ->+ glInvalidateNamedFramebufferSubData (framebufferID fbo) numAttachments atts x y w h++-- | A version of 'invalidateSubFramebuffer' affecting the whole viewport.++invalidateFramebuffer :: FramebufferTarget -> [FramebufferObjectAttachment] -> IO ()+invalidateFramebuffer target attachments =+ withAttachments attachments $+ glInvalidateFramebuffer (marshalFramebufferTarget target)++-- | The direct-state-access version of 'invalidateFramebuffer'.++invalidateNamedFramebufferData :: FramebufferObject -> [FramebufferObjectAttachment] -> IO ()+invalidateNamedFramebufferData fbo attachments =+ withAttachments attachments $+ glInvalidateNamedFramebufferData (framebufferID fbo)++withAttachments :: [FramebufferObjectAttachment] -> (GLsizei -> Ptr GLenum -> IO ()) -> IO ()+withAttachments attachments success+ | all isJust atts = withArrayLen (catMaybes atts) $ \len buf ->+ success (fromIntegral len) buf+ | otherwise = recordInvalidEnum+ where atts = map marshalFramebufferObjectAttachment attachments++--------------------------------------------------------------------------------++-- | The implementation and context dependent number of auxiliary buffers.++auxBuffers :: GettableStateVar GLsizei+auxBuffers = makeGettableStateVar $ getSizei1 id GetAuxBuffers++-- | 'True' if front and back buffers exist.++doubleBuffer :: GettableStateVar Bool+doubleBuffer =+ makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetDoublebuffer++-- | 'True' if left and right buffers exist.++stereoBuffer :: GettableStateVar Bool+stereoBuffer =+ makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetStereo++rgbaBits :: GettableStateVar (Color4 GLsizei)+rgbaBits =+ makeGettableStateVar $+ liftM4 Color4 (getSizei1 id GetRedBits)+ (getSizei1 id GetGreenBits)+ (getSizei1 id GetBlueBits)+ (getSizei1 id GetAlphaBits)++stencilBits :: GettableStateVar GLsizei+stencilBits = makeGettableStateVar $ getSizei1 id GetStencilBits++depthBits :: GettableStateVar GLsizei+depthBits = makeGettableStateVar $ getSizei1 id GetDepthBits++accumBits :: GettableStateVar (Color4 GLsizei)+accumBits =+ makeGettableStateVar $+ liftM4 Color4 (getSizei1 id GetAccumRedBits)+ (getSizei1 id GetAccumGreenBits)+ (getSizei1 id GetAccumBlueBits)+ (getSizei1 id GetAccumAlphaBits)++rgbaSignedComponents :: GettableStateVar (Color4 Bool)+rgbaSignedComponents =+ makeGettableStateVar $+ getInteger4 (\r g b a -> Color4 (unmarshalGLboolean r)+ (unmarshalGLboolean g)+ (unmarshalGLboolean b)+ (unmarshalGLboolean a))+ GetRGBASignedComponents++--------------------------------------------------------------------------------+ -- | An operation on the accumulation buffer. data AccumOp =@@ -391,11 +519,11 @@ marshalAccumOp :: AccumOp -> GLenum marshalAccumOp x = case x of- Accum -> gl_ACCUM- Load -> gl_LOAD- Return -> gl_RETURN- Mult -> gl_MULT- Add -> gl_ADD+ Accum -> GL_ACCUM+ Load -> GL_LOAD+ Return -> GL_RETURN+ Mult -> GL_MULT+ Add -> GL_ADD --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects.hs view
@@ -1,6 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/Attachments.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.Attachments--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -29,7 +29,7 @@ import Graphics.Rendering.OpenGL.GL.Texturing.TextureObject import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -----------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObject.hs view
@@ -2,14 +2,14 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObject--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2013-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com> -- Stability : stable -- Portability : portable ----- This is a purely internal module for handling FrameBufferObjects.+-- This is a purely internal module for handling FramebufferObjects. -- -------------------------------------------------------------------------------- @@ -17,25 +17,32 @@ FramebufferObject(..) ) where -import Foreign.Marshal+import Control.Monad.IO.Class+import Data.ObjectName+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- -data FramebufferObject = FramebufferObject { framebufferID :: GLuint }+newtype FramebufferObject = FramebufferObject { framebufferID :: GLuint } deriving ( Eq, Ord, Show ) instance ObjectName FramebufferObject where- isObjectName = fmap unmarshalGLboolean . glIsFramebuffer . framebufferID+ isObjectName =+ liftIO . fmap unmarshalGLboolean . glIsFramebuffer . framebufferID deleteObjectNames objs =- withArrayLen (map framebufferID objs) $+ liftIO . withArrayLen (map framebufferID objs) $ glDeleteFramebuffers . fromIntegral instance GeneratableObjectName FramebufferObject where genObjectNames n =- allocaArray n $ \buf -> do+ liftIO . allocaArray n $ \buf -> do glGenFramebuffers (fromIntegral n) buf fmap (map FramebufferObject) $ peekArray n buf++instance CanBeLabeled FramebufferObject where+ objectLabel = objectNameLabel GL_FRAMEBUFFER . framebufferID
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObjectAttachment.hs view
@@ -2,14 +2,14 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjectAttachment--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2013-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com> -- Stability : stable -- Portability : portable ----- This is a purely internal module for marshaling FrameBufferObjectAttachments.+-- This is a purely internal module for marshaling FramebufferObjectAttachments. -- -------------------------------------------------------------------------------- @@ -28,7 +28,7 @@ import Graphics.Rendering.OpenGL.GL.BufferMode import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -43,30 +43,30 @@ marshalFramebufferObjectAttachment x = case x of ColorAttachment c -> let ec = fromIntegral c in if ec >= maxColorAttachments then Nothing- else Just $ gl_COLOR_ATTACHMENT0 + ec- DepthAttachment -> Just gl_DEPTH_ATTACHMENT- StencilAttachment -> Just gl_STENCIL_ATTACHMENT- DepthStencilAttachment -> Just gl_DEPTH_STENCIL_ATTACHMENT+ else Just $ GL_COLOR_ATTACHMENT0 + ec+ DepthAttachment -> Just GL_DEPTH_ATTACHMENT+ StencilAttachment -> Just GL_STENCIL_ATTACHMENT+ DepthStencilAttachment -> Just GL_DEPTH_STENCIL_ATTACHMENT unmarshalFramebufferObjectAttachment :: GLenum -> FramebufferObjectAttachment unmarshalFramebufferObjectAttachment x = maybe (error $ "unmarshalFramebufferObjectAttachment: unknown enum value " ++ show x) id $ unmarshalFramebufferObjectAttachmentSafe x --unmarshalFramebufferObjectAttachment x--- | x == gl_DEPTH_ATTACHMENT = DepthAttachment--- | x == gl_STENCIL_ATTACHMENT = StencilAttachment--- | x == gl_DEPTH_STENCIL_ATTACHMENT = DepthStencilAttachment+-- | x == GL_DEPTH_ATTACHMENT = DepthAttachment+-- | x == GL_STENCIL_ATTACHMENT = StencilAttachment+-- | x == GL_DEPTH_STENCIL_ATTACHMENT = DepthStencilAttachment -- | x >= gl_COLOR_ATTACHMENT0 && x <= gl_COLOR_ATTACHMENT15 -- = ColorAttachment . fromIntegral $ x - gl_COLOR_ATTACHMENT0 -- | otherwise = error $ "unmarshalFramebufferObjectAttachment: unknown enum value " ++ show x unmarshalFramebufferObjectAttachmentSafe :: GLenum -> Maybe FramebufferObjectAttachment unmarshalFramebufferObjectAttachmentSafe x- | x == gl_DEPTH_ATTACHMENT = Just DepthAttachment- | x == gl_STENCIL_ATTACHMENT = Just StencilAttachment- | x == gl_DEPTH_STENCIL_ATTACHMENT = Just DepthStencilAttachment- | x >= gl_COLOR_ATTACHMENT0 && x <= gl_COLOR_ATTACHMENT0 + maxColorAttachments- = Just . ColorAttachment . fromIntegral $ x - gl_COLOR_ATTACHMENT0+ | x == GL_DEPTH_ATTACHMENT = Just DepthAttachment+ | x == GL_STENCIL_ATTACHMENT = Just StencilAttachment+ | x == GL_DEPTH_STENCIL_ATTACHMENT = Just DepthStencilAttachment+ | x >= GL_COLOR_ATTACHMENT0 && x <= GL_COLOR_ATTACHMENT0 + maxColorAttachments+ = Just . ColorAttachment . fromIntegral $ x - GL_COLOR_ATTACHMENT0 | otherwise = Nothing fboaToBufferMode :: FramebufferObjectAttachment -> Maybe BufferMode
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferObjects.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjects--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,11 +16,11 @@ FramebufferStatus(..), framebufferStatus, ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObject import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -61,14 +61,14 @@ unmarshalFramebufferStatus :: GLenum -> FramebufferStatus unmarshalFramebufferStatus x- | x == gl_FRAMEBUFFER_COMPLETE = Complete- | x == gl_FRAMEBUFFER_UNDEFINED = Undefined- | x == gl_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT+ | x == GL_FRAMEBUFFER_COMPLETE = Complete+ | x == GL_FRAMEBUFFER_UNDEFINED = Undefined+ | x == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = IncompleteMissingAttachment- | x == gl_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = IncompleteDrawBuffer- | x == gl_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = IncompleteReadBuffer- | x == gl_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = IncompleteMultiSample- | x == gl_FRAMEBUFFER_UNSUPPORTED = Unsupported+ | x == GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = IncompleteDrawBuffer+ | x == GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = IncompleteReadBuffer+ | x == GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = IncompleteMultiSample+ | x == GL_FRAMEBUFFER_UNSUPPORTED = Unsupported | otherwise = error $ "unmarshalFramebufferStatus: unknown value: " ++ show x
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/FramebufferTarget.hs view
@@ -2,14 +2,14 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2013-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com> -- Stability : stable -- Portability : portable ----- This is a purely internal module for marshaling FrameBufferTargets.+-- This is a purely internal module for marshaling FramebufferTargets. -- -------------------------------------------------------------------------------- @@ -17,7 +17,7 @@ FramebufferTarget(..), marshalFramebufferTarget ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -29,6 +29,6 @@ marshalFramebufferTarget :: FramebufferTarget -> GLenum marshalFramebufferTarget xs = case xs of- DrawFramebuffer -> gl_DRAW_FRAMEBUFFER- ReadFramebuffer -> gl_READ_FRAMEBUFFER- Framebuffer -> gl_FRAMEBUFFER+ DrawFramebuffer -> GL_DRAW_FRAMEBUFFER+ ReadFramebuffer -> GL_READ_FRAMEBUFFER+ Framebuffer -> GL_FRAMEBUFFER
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/Queries.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.Queries--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -25,16 +25,16 @@ renderbufferAlphaSize, renderbufferDepthSize, renderbufferStencilSize, ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjectAttachment import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObject import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.Texturing.Specification(Level) import Graphics.Rendering.OpenGL.GL.Texturing.TextureObject import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -55,19 +55,19 @@ marshalGetFBAPName :: GetFramebufferAttachmentPName -> GLenum marshalGetFBAPName x = case x of- AttachmentObjectType -> gl_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE- AttachmentObjectName -> gl_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME- AttachmentTextureLevel -> gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL- AttachmentTextureCubeMapFace -> gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE- AttachmentTextureLayer -> gl_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER- AttachmentComponentType -> gl_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE -- TODO impement usefull function- AttachmentColorEncoding -> gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING -- TODO impement usefull function- AttachmentRedSize -> gl_FRAMEBUFFER_ATTACHMENT_RED_SIZE- AttachmentBlueSize -> gl_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE- AttachmentGreenSize -> gl_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE- AttachmentAlphaSize -> gl_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE- AttachmentDepthSize -> gl_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE- AttachmentStencilSize -> gl_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE+ AttachmentObjectType -> GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE+ AttachmentObjectName -> GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME+ AttachmentTextureLevel -> GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL+ AttachmentTextureCubeMapFace -> GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE+ AttachmentTextureLayer -> GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER+ AttachmentComponentType -> GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE -- TODO impement usefull function+ AttachmentColorEncoding -> GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING -- TODO impement usefull function+ AttachmentRedSize -> GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE+ AttachmentBlueSize -> GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE+ AttachmentGreenSize -> GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE+ AttachmentAlphaSize -> GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE+ AttachmentDepthSize -> GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE+ AttachmentStencilSize -> GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE getFBAPName :: FramebufferAttachment fba => FramebufferTarget -> fba -> (GLint -> a) -> GetFramebufferAttachmentPName -> IO a@@ -83,10 +83,10 @@ unmarshalAttachmentObjectType :: GLenum -> Maybe AttachmentObjectType unmarshalAttachmentObjectType x- | x == gl_FRAMEBUFFER_DEFAULT = Just DefaultFramebufferAttachment- | x == gl_TEXTURE = Just TextureAttachment- | x == gl_RENDERBUFFER = Just RenderbufferAttachment- | x == gl_NONE = Nothing+ | x == GL_FRAMEBUFFER_DEFAULT = Just DefaultFramebufferAttachment+ | x == GL_TEXTURE = Just TextureAttachment+ | x == GL_RENDERBUFFER = Just RenderbufferAttachment+ | x == GL_NONE = Nothing | otherwise = error $ "unmarshalAttachmentObject: unknown value " ++ show x attachmentObjectType :: FramebufferAttachment fba => FramebufferTarget -> fba@@ -173,16 +173,16 @@ marshalGetRBPname :: GetRenderbufferPName -> GLenum marshalGetRBPname x = case x of- RenderbufferWidth -> gl_RENDERBUFFER_WIDTH- RenderbufferHeight -> gl_RENDERBUFFER_HEIGHT- RenderbufferInternalFormat -> gl_RENDERBUFFER_INTERNAL_FORMAT- RenderbufferSamples -> gl_RENDERBUFFER_SAMPLES- RenderbufferRedSize -> gl_RENDERBUFFER_RED_SIZE- RenderbufferBlueSize -> gl_RENDERBUFFER_BLUE_SIZE- RenderbufferGreenSize -> gl_RENDERBUFFER_GREEN_SIZE- RenderbufferAlphaSize -> gl_RENDERBUFFER_ALPHA_SIZE- RenderbufferDepthSize -> gl_RENDERBUFFER_DEPTH_SIZE- RenderbufferStencilSize -> gl_RENDERBUFFER_STENCIL_SIZE+ RenderbufferWidth -> GL_RENDERBUFFER_WIDTH+ RenderbufferHeight -> GL_RENDERBUFFER_HEIGHT+ RenderbufferInternalFormat -> GL_RENDERBUFFER_INTERNAL_FORMAT+ RenderbufferSamples -> GL_RENDERBUFFER_SAMPLES+ RenderbufferRedSize -> GL_RENDERBUFFER_RED_SIZE+ RenderbufferBlueSize -> GL_RENDERBUFFER_BLUE_SIZE+ RenderbufferGreenSize -> GL_RENDERBUFFER_GREEN_SIZE+ RenderbufferAlphaSize -> GL_RENDERBUFFER_ALPHA_SIZE+ RenderbufferDepthSize -> GL_RENDERBUFFER_DEPTH_SIZE+ RenderbufferStencilSize -> GL_RENDERBUFFER_STENCIL_SIZE getRBPName :: RenderbufferTarget -> (GLint -> a) -> GetRenderbufferPName -> IO a
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferObject.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObject--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,25 +17,33 @@ RenderbufferObject(..) ) where -import Foreign.Marshal++import Control.Monad.IO.Class+import Data.ObjectName+import Foreign.Marshal ( allocaArray, peekArray, withArrayLen )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- -data RenderbufferObject = RenderbufferObject { renderbufferID :: GLuint}+newtype RenderbufferObject = RenderbufferObject { renderbufferID :: GLuint} deriving ( Eq, Ord, Show ) instance ObjectName RenderbufferObject where- isObjectName = fmap unmarshalGLboolean . glIsRenderbuffer . renderbufferID+ isObjectName =+ liftIO . fmap unmarshalGLboolean . glIsRenderbuffer . renderbufferID deleteObjectNames objs =- withArrayLen (map renderbufferID objs) $+ liftIO . withArrayLen (map renderbufferID objs) $ glDeleteRenderbuffers . fromIntegral instance GeneratableObjectName RenderbufferObject where genObjectNames n =- allocaArray n $ \buf -> do+ liftIO . allocaArray n $ \buf -> do glGenRenderbuffers (fromIntegral n) buf fmap (map RenderbufferObject) $ peekArray n buf++instance CanBeLabeled RenderbufferObject where+ objectLabel = objectNameLabel GL_RENDERBUFFER . renderbufferID
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferObjects.hs view
@@ -1,8 +1,7 @@-{-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObjects--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,12 +21,12 @@ renderbufferStorage, renderbufferStorageMultiSample, ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObject import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -----------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/FramebufferObjects/RenderbufferTarget.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,7 +19,7 @@ import Foreign.Marshal import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -28,7 +28,7 @@ marshalRenderbufferTarget :: RenderbufferTarget -> GLenum marshalRenderbufferTarget x = case x of- Renderbuffer -> gl_RENDERBUFFER+ Renderbuffer -> GL_RENDERBUFFER -----------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/GLboolean.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.GLboolean--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,14 +17,14 @@ marshalGLboolean, unmarshalGLboolean ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- marshalGLboolean :: Num a => Bool -> a marshalGLboolean x = fromIntegral $ case x of- False -> gl_FALSE- True -> gl_TRUE+ False -> GL_FALSE+ True -> GL_TRUE unmarshalGLboolean :: (Eq a, Num a) => a -> Bool-unmarshalGLboolean = (/= fromIntegral gl_FALSE)+unmarshalGLboolean = (/= fromIntegral GL_FALSE)
src/Graphics/Rendering/OpenGL/GL/Hints.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Hints--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,9 +16,9 @@ HintTarget(..), HintMode(..), hint ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -36,15 +36,15 @@ marshalHintTarget :: HintTarget -> GLenum marshalHintTarget x = case x of- PerspectiveCorrection -> gl_PERSPECTIVE_CORRECTION_HINT- PointSmooth -> gl_POINT_SMOOTH_HINT- LineSmooth -> gl_LINE_SMOOTH_HINT- PolygonSmooth -> gl_POLYGON_SMOOTH_HINT- Fog -> gl_FOG_HINT- GenerateMipmap -> gl_GENERATE_MIPMAP_HINT- TextureCompression -> gl_TEXTURE_COMPRESSION_HINT- PackCMYK -> gl_PACK_CMYK_HINT_EXT- UnpackCMYK -> gl_UNPACK_CMYK_HINT_EXT+ PerspectiveCorrection -> GL_PERSPECTIVE_CORRECTION_HINT+ PointSmooth -> GL_POINT_SMOOTH_HINT+ LineSmooth -> GL_LINE_SMOOTH_HINT+ PolygonSmooth -> GL_POLYGON_SMOOTH_HINT+ Fog -> GL_FOG_HINT+ GenerateMipmap -> GL_GENERATE_MIPMAP_HINT+ TextureCompression -> GL_TEXTURE_COMPRESSION_HINT+ PackCMYK -> GL_PACK_CMYK_HINT_EXT+ UnpackCMYK -> GL_UNPACK_CMYK_HINT_EXT hintTargetToGetPName :: HintTarget -> PName1I hintTargetToGetPName x = case x of@@ -68,15 +68,15 @@ marshalHintMode :: HintMode -> GLenum marshalHintMode x = case x of- DontCare -> gl_DONT_CARE- Fastest -> gl_FASTEST- Nicest -> gl_NICEST+ DontCare -> GL_DONT_CARE+ Fastest -> GL_FASTEST+ Nicest -> GL_NICEST unmarshalHintMode :: GLenum -> HintMode unmarshalHintMode x- | x == gl_DONT_CARE = DontCare- | x == gl_FASTEST = Fastest- | x == gl_NICEST = Nicest+ | x == GL_DONT_CARE = DontCare+ | x == GL_FASTEST = Fastest+ | x == GL_NICEST = Nicest | otherwise = error ("unmarshalHintMode: illegal value " ++ show x) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/IOState.hs view
@@ -1,8 +1,9 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_HADDOCK hide #-} -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.IOState--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +19,9 @@ IOState(..), getIOState, peekIOState, evalIOState, nTimes ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ( Applicative(..) )+#endif import Control.Monad ( ap, liftM, replicateM ) import Foreign.Ptr ( Ptr, plusPtr ) import Foreign.Storable ( Storable(sizeOf,peek) )@@ -37,6 +40,9 @@ instance Monad (IOState s) where return a = IOState $ \s -> return (a, s) m >>= k = IOState $ \s -> do (a, s') <- runIOState m s ; runIOState (k a) s'+#if MIN_VERSION_base(4,13,0)+instance MonadFail (IOState s) where+#endif fail str = IOState $ \_ -> fail str getIOState :: IOState s (Ptr s)
src/Graphics/Rendering/OpenGL/GL/LineSegments.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.LineSegments--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -28,10 +28,10 @@ ) where import Control.Monad+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
+ src/Graphics/Rendering/OpenGL/GL/MatrixComponent.hs view
@@ -0,0 +1,61 @@+{-# LANGUAGE TypeSynonymInstances #-}+{-# OPTIONS_HADDOCK hide #-}+--------------------------------------------------------------------------------+-- |+-- Module : Graphics.Rendering.OpenGL.GL.CoordTrans+-- Copyright : (c) Sven Panne 2002-2019+-- License : BSD3+--+-- Maintainer : Sven Panne <svenpanne@gmail.com>+-- Stability : stable+-- Portability : portable+--+-- This is a purely internal module for handling matrix components.+--+--------------------------------------------------------------------------------++module Graphics.Rendering.OpenGL.GL.MatrixComponent where++import Foreign.Ptr+import Foreign.Storable+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.Rendering.OpenGL.GL.Tensor+import Graphics.GL++--------------------------------------------------------------------------------++class Storable c => MatrixComponent c where+ getMatrix :: GetPNameMatrix p => p -> Ptr c -> IO ()+ loadMatrix :: Ptr c -> IO ()+ loadTransposeMatrix :: Ptr c -> IO ()+ multMatrix_ :: Ptr c -> IO ()+ multTransposeMatrix :: Ptr c -> IO ()+ getUniformv :: GLuint -> GLint -> Ptr c -> IO ()+ uniformMatrix4v :: GLint -> GLsizei -> GLboolean -> Ptr c -> IO ()+ rotate :: c -> Vector3 c -> IO ()+ translate :: Vector3 c -> IO ()+ scale :: c -> c -> c -> IO ()++instance MatrixComponent GLfloat where+ getMatrix = getMatrixf+ loadMatrix = glLoadMatrixf+ loadTransposeMatrix = glLoadTransposeMatrixf+ multMatrix_ = glMultMatrixf+ multTransposeMatrix = glMultTransposeMatrixf+ getUniformv = glGetUniformfv+ uniformMatrix4v = glUniformMatrix4fv+ rotate a (Vector3 x y z) = glRotatef a x y z+ translate (Vector3 x y z) = glTranslatef x y z+ scale = glScalef++instance MatrixComponent GLdouble where+ getMatrix = getMatrixd+ loadMatrix = glLoadMatrixd+ loadTransposeMatrix = glLoadTransposeMatrixd+ multMatrix_ = glMultMatrixd+ multTransposeMatrix = glMultTransposeMatrixd+ getUniformv = glGetUniformdv+ uniformMatrix4v = glUniformMatrix4dv+ rotate a (Vector3 x y z) = glRotated a x y z+ translate (Vector3 x y z) = glTranslated x y z+ scale = glScaled
− src/Graphics/Rendering/OpenGL/GL/ObjectName.hs
@@ -1,75 +0,0 @@-{-# LANGUAGE CPP #-}------------------------------------------------------------------------------------ |--- Module : Graphics.Rendering.OpenGL.GL.ObjectName--- Copyright : (c) Sven Panne 2013--- License : BSD3--- --- Maintainer : Sven Panne <svenpanne@gmail.com>--- Stability : stable--- Portability : portable------ This module corresponds to section 2.5 (Objects and the Object Model) of the--- OpenGL 4.4 specs.------ Object names are explicitly handled identifiers for API objects, e.g. a--- texture object name in OpenGL or a buffer object name in OpenAL. They come in--- two flavors: If a name can exist on its own without an associated object, we--- have a 'GeneratableObjectName', otherwise we have an 'ObjectName'.--------------------------------------------------------------------------------------module Graphics.Rendering.OpenGL.GL.ObjectName (- ObjectName(..), GeneratableObjectName(..)-) where--import Control.Monad ( replicateM )-------------------------------------------------------------------------------------- | An 'ObjectName' is an explicitly handled identifier for API objects, e.g. a--- texture object name in OpenGL or a buffer object name in OpenAL.-#if __GLASGOW_HASKELL__ < 708------ Minimal complete definition: 'isObjectName' plus one of 'deleteObjectName' or--- 'deleteObjectNames'.-#endif--class ObjectName a where-#if __GLASGOW_HASKELL__ >= 708- {-# MINIMAL isObjectName, ( deleteObjectName | deleteObjectNames ) #-}-#endif- -- | Test if the given object name is currently in use, i.e. test if it has- -- been generated, but not been deleted so far.- isObjectName :: a -> IO Bool-- -- | Make the given object name available again, declaring it as unused.- deleteObjectName :: a -> IO ()- deleteObjectName = deleteObjectNames . (:[])-- -- | Bulk version of 'deleteObjectName'.- deleteObjectNames:: [a] -> IO ()- deleteObjectNames = mapM_ deleteObjectName---- | A 'GeneratableObjectName' is an 'ObjectName' which can be generated without--- creating an associated object at the same time, e.g. an OpenGL buffer object--- name. Note that e.g. OpenGL program object names do not fall into this--- category, because you can only create such a name together with a program--- object itself.-#if __GLASGOW_HASKELL__ < 708------ Minimal complete definition: One of 'genObjectName' or 'genObjectNames'.-#endif--class ObjectName a => GeneratableObjectName a where-#if __GLASGOW_HASKELL__ >= 708- {-# MINIMAL genObjectName | genObjectNames #-}-#endif- -- | Generate a new unused object name. By generating the name, it becomes- -- used.- genObjectName :: IO a- genObjectName = fmap head $ genObjectNames 1-- -- | Bulk version of 'genObjectName'.- genObjectNames :: Int -> IO [a]- genObjectNames = flip replicateM genObjectName
src/Graphics/Rendering/OpenGL/GL/PeekPoke.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PeekPoke--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/PerFragment.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PerFragment--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -48,6 +48,7 @@ ) where import Control.Monad+import Data.StateVar import Graphics.Rendering.OpenGL.GL.BlendingFactor import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.ComparisonFunction@@ -57,9 +58,9 @@ import Graphics.Rendering.OpenGL.GL.Framebuffer import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GLU.ErrorsInternal+import Graphics.GL -------------------------------------------------------------------------------- @@ -126,16 +127,28 @@ stencilFunc :: StateVar (ComparisonFunction, GLint, GLuint) stencilFunc = makeStateVar- (liftM3 (,,) (getEnum1 unmarshalComparisonFunction GetStencilFunc)- (getInteger1 id GetStencilRef)- (getInteger1 fromIntegral GetStencilValueMask))+ (get (stencilFuncSeparate Front)) (\(func, ref, mask) -> glStencilFunc (marshalComparisonFunction func) ref mask) -stencilFuncSeparate :: Face -> SettableStateVar (ComparisonFunction, GLint, GLuint)+stencilFuncSeparate :: Face -> StateVar (ComparisonFunction, GLint, GLuint) stencilFuncSeparate face =- makeSettableStateVar $ \(func, ref, mask) ->- glStencilFuncSeparate (marshalFace face) (marshalComparisonFunction func) ref mask+ makeStateVar+ (case face of+ Front -> getStencilFunc GetStencilFunc+ GetStencilRef+ GetStencilValueMask+ Back -> getStencilFunc GetStencilBackFunc+ GetStencilBackRef+ GetStencilBackValueMask+ FrontAndBack -> do recordInvalidEnum; return (Never, 0, 0))+ (\(func, ref, mask) ->+ glStencilFuncSeparate (marshalFace face)+ (marshalComparisonFunction func) ref mask)+ where getStencilFunc func ref mask =+ liftM3 (,,) (getEnum1 unmarshalComparisonFunction func)+ (getInteger1 id ref)+ (getInteger1 fromIntegral mask) -------------------------------------------------------------------------------- @@ -152,25 +165,25 @@ marshalStencilOp :: StencilOp -> GLenum marshalStencilOp x = case x of- OpZero -> gl_ZERO- OpKeep -> gl_KEEP- OpReplace -> gl_REPLACE- OpIncr -> gl_INCR- OpIncrWrap -> gl_INCR_WRAP- OpDecr -> gl_DECR- OpDecrWrap -> gl_DECR_WRAP- OpInvert -> gl_INVERT+ OpZero -> GL_ZERO+ OpKeep -> GL_KEEP+ OpReplace -> GL_REPLACE+ OpIncr -> GL_INCR+ OpIncrWrap -> GL_INCR_WRAP+ OpDecr -> GL_DECR+ OpDecrWrap -> GL_DECR_WRAP+ OpInvert -> GL_INVERT unmarshalStencilOp :: GLenum -> StencilOp unmarshalStencilOp x- | x == gl_ZERO = OpZero- | x == gl_KEEP = OpKeep- | x == gl_REPLACE = OpReplace- | x == gl_INCR = OpIncr- | x == gl_INCR_WRAP = OpIncrWrap- | x == gl_DECR = OpDecr- | x == gl_DECR_WRAP = OpDecrWrap- | x == gl_INVERT = OpInvert+ | x == GL_ZERO = OpZero+ | x == GL_KEEP = OpKeep+ | x == GL_REPLACE = OpReplace+ | x == GL_INCR = OpIncr+ | x == GL_INCR_WRAP = OpIncrWrap+ | x == GL_DECR = OpDecr+ | x == GL_DECR_WRAP = OpDecrWrap+ | x == GL_INVERT = OpInvert | otherwise = error ("unmarshalStencilOp: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -178,21 +191,33 @@ stencilOp :: StateVar (StencilOp, StencilOp, StencilOp) stencilOp = makeStateVar- (liftM3 (,,) (getEnum1 unmarshalStencilOp GetStencilFail)- (getEnum1 unmarshalStencilOp GetStencilPassDepthFail)- (getEnum1 unmarshalStencilOp GetStencilPassDepthPass))+ (get (stencilOpSeparate Front)) (\(sf, spdf, spdp) -> glStencilOp (marshalStencilOp sf) (marshalStencilOp spdf) (marshalStencilOp spdp)) -stencilOpSeparate :: Face -> SettableStateVar (StencilOp, StencilOp, StencilOp)+stencilOpSeparate :: Face -> StateVar (StencilOp, StencilOp, StencilOp) stencilOpSeparate face =- makeSettableStateVar $ \(sf, spdf, spdp) ->- glStencilOpSeparate (marshalFace face)- (marshalStencilOp sf)- (marshalStencilOp spdf)- (marshalStencilOp spdp)+ makeStateVar+ (case face of+ Front -> getStencilOp GetStencilFail+ GetStencilPassDepthFail+ GetStencilPassDepthPass+ Back -> getStencilOp GetStencilBackFail+ GetStencilBackPassDepthFail+ GetStencilBackPassDepthPass+ FrontAndBack -> do recordInvalidEnum+ return (OpZero, OpZero, OpZero))+ (\(sf, spdf, spdp) -> glStencilOpSeparate (marshalFace face)+ (marshalStencilOp sf)+ (marshalStencilOp spdf)+ (marshalStencilOp spdp))+ where getStencilOp sf spdf spdp =+ (liftM3 (,,) (getEnum1 unmarshalStencilOp sf)+ (getEnum1 unmarshalStencilOp spdf)+ (getEnum1 unmarshalStencilOp spdp)) + -------------------------------------------------------------------------------- activeStencilFace :: StateVar (Maybe Face)@@ -219,7 +244,7 @@ -- | enable or disable blending based on the buffer bound to the /i/'th drawBuffer -- that is the buffer fmap (!! i) (get drawBuffers) blendBuffer :: DrawBufferIndex -> StateVar Capability-blendBuffer = makeIndexedCapability ((fromIntegral gl_DRAW_BUFFER0) +) BlendI+blendBuffer = makeIndexedCapability ((fromIntegral GL_DRAW_BUFFER0) +) BlendI -------------------------------------------------------------------------------- @@ -234,21 +259,21 @@ marshalBlendEquation :: BlendEquation -> GLenum marshalBlendEquation x = case x of- FuncAdd -> gl_FUNC_ADD- FuncSubtract -> gl_FUNC_SUBTRACT- FuncReverseSubtract -> gl_FUNC_REVERSE_SUBTRACT- Min -> gl_MIN- Max -> gl_MAX- LogicOp -> gl_INDEX_LOGIC_OP+ FuncAdd -> GL_FUNC_ADD+ FuncSubtract -> GL_FUNC_SUBTRACT+ FuncReverseSubtract -> GL_FUNC_REVERSE_SUBTRACT+ Min -> GL_MIN+ Max -> GL_MAX+ LogicOp -> GL_INDEX_LOGIC_OP unmarshalBlendEquation :: GLenum -> BlendEquation unmarshalBlendEquation x- | x == gl_FUNC_ADD = FuncAdd- | x == gl_FUNC_SUBTRACT = FuncSubtract- | x == gl_FUNC_REVERSE_SUBTRACT = FuncReverseSubtract- | x == gl_MIN = Min- | x == gl_MAX = Max- | x == gl_INDEX_LOGIC_OP = LogicOp+ | x == GL_FUNC_ADD = FuncAdd+ | x == GL_FUNC_SUBTRACT = FuncSubtract+ | x == GL_FUNC_REVERSE_SUBTRACT = FuncReverseSubtract+ | x == GL_MIN = Min+ | x == GL_MAX = Max+ | x == GL_INDEX_LOGIC_OP = LogicOp | otherwise = error ("unmarshalBlendEquation: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -327,41 +352,41 @@ marshalLogicOp :: LogicOp -> GLenum marshalLogicOp x = case x of- Clear -> gl_CLEAR- And -> gl_AND- AndReverse -> gl_AND_REVERSE- Copy -> gl_COPY- AndInverted -> gl_AND_INVERTED- Noop -> gl_NOOP- Xor -> gl_XOR- Or -> gl_OR- Nor -> gl_NOR- Equiv -> gl_EQUIV- Invert -> gl_INVERT- OrReverse -> gl_OR_REVERSE- CopyInverted -> gl_COPY_INVERTED- OrInverted -> gl_OR_INVERTED- Nand -> gl_NAND- Set -> gl_SET+ Clear -> GL_CLEAR+ And -> GL_AND+ AndReverse -> GL_AND_REVERSE+ Copy -> GL_COPY+ AndInverted -> GL_AND_INVERTED+ Noop -> GL_NOOP+ Xor -> GL_XOR+ Or -> GL_OR+ Nor -> GL_NOR+ Equiv -> GL_EQUIV+ Invert -> GL_INVERT+ OrReverse -> GL_OR_REVERSE+ CopyInverted -> GL_COPY_INVERTED+ OrInverted -> GL_OR_INVERTED+ Nand -> GL_NAND+ Set -> GL_SET unmarshalLogicOp :: GLenum -> LogicOp unmarshalLogicOp x- | x == gl_CLEAR = Clear- | x == gl_AND = And- | x == gl_AND_REVERSE = AndReverse- | x == gl_COPY = Copy- | x == gl_AND_INVERTED = AndInverted- | x == gl_NOOP = Noop- | x == gl_XOR = Xor- | x == gl_OR = Or- | x == gl_NOR = Nor- | x == gl_EQUIV = Equiv- | x == gl_INVERT = Invert- | x == gl_OR_REVERSE = OrReverse- | x == gl_COPY_INVERTED = CopyInverted- | x == gl_OR_INVERTED = OrInverted- | x == gl_NAND = Nand- | x == gl_SET = Set+ | x == GL_CLEAR = Clear+ | x == GL_AND = And+ | x == GL_AND_REVERSE = AndReverse+ | x == GL_COPY = Copy+ | x == GL_AND_INVERTED = AndInverted+ | x == GL_NOOP = Noop+ | x == GL_XOR = Xor+ | x == GL_OR = Or+ | x == GL_NOR = Nor+ | x == GL_EQUIV = Equiv+ | x == GL_INVERT = Invert+ | x == GL_OR_REVERSE = OrReverse+ | x == GL_COPY_INVERTED = CopyInverted+ | x == GL_OR_INVERTED = OrInverted+ | x == GL_NAND = Nand+ | x == GL_SET = Set | otherwise = error ("unmarshalLogicOp: illegal value " ++ show x) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelData.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelData--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,7 +20,7 @@ import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.DataType import Graphics.Rendering.OpenGL.GL.PixelFormat-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelFormat.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelFormat--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ PixelFormat(..), marshalPixelFormat, unmarshalPixelFormat ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -58,71 +58,71 @@ marshalPixelFormat :: PixelFormat -> GLenum marshalPixelFormat x = case x of- ColorIndex -> gl_COLOR_INDEX- StencilIndex -> gl_STENCIL_INDEX- DepthComponent -> gl_DEPTH_COMPONENT- Red -> gl_RED- Green -> gl_GREEN- Blue -> gl_BLUE- Alpha -> gl_ALPHA- RG -> gl_RG- RGB -> gl_RGB- RGBA -> gl_RGBA- Luminance -> gl_LUMINANCE- LuminanceAlpha -> gl_LUMINANCE_ALPHA- RedInteger -> gl_RED_INTEGER- GreenInteger -> gl_GREEN_INTEGER- BlueInteger -> gl_BLUE_INTEGER- AlphaInteger -> gl_ALPHA_INTEGER- RGInteger -> gl_RG_INTEGER- RGBInteger -> gl_RGB_INTEGER- RGBAInteger -> gl_RGBA_INTEGER- BGRInteger -> gl_BGR_INTEGER- BGRAInteger -> gl_BGRA_INTEGER- ABGR -> gl_ABGR_EXT- BGR -> gl_BGR- BGRA -> gl_BGRA- CMYK -> gl_CMYK_EXT- CMYKA -> gl_CMYKA_EXT- FourTwoTwo -> gl_422_EXT- FourTwoTwoRev -> gl_422_REV_EXT- FourTwoTwoAverage -> gl_422_AVERAGE_EXT- FourTwoTwoRevAverage -> gl_422_REV_AVERAGE_EXT- YCBCR422 -> gl_YCBCR_422_APPLE- DepthStencil -> gl_DEPTH_STENCIL+ ColorIndex -> GL_COLOR_INDEX+ StencilIndex -> GL_STENCIL_INDEX+ DepthComponent -> GL_DEPTH_COMPONENT+ Red -> GL_RED+ Green -> GL_GREEN+ Blue -> GL_BLUE+ Alpha -> GL_ALPHA+ RG -> GL_RG+ RGB -> GL_RGB+ RGBA -> GL_RGBA+ Luminance -> GL_LUMINANCE+ LuminanceAlpha -> GL_LUMINANCE_ALPHA+ RedInteger -> GL_RED_INTEGER+ GreenInteger -> GL_GREEN_INTEGER+ BlueInteger -> GL_BLUE_INTEGER+ AlphaInteger -> GL_ALPHA_INTEGER+ RGInteger -> GL_RG_INTEGER+ RGBInteger -> GL_RGB_INTEGER+ RGBAInteger -> GL_RGBA_INTEGER+ BGRInteger -> GL_BGR_INTEGER+ BGRAInteger -> GL_BGRA_INTEGER+ ABGR -> GL_ABGR_EXT+ BGR -> GL_BGR+ BGRA -> GL_BGRA+ CMYK -> GL_CMYK_EXT+ CMYKA -> GL_CMYKA_EXT+ FourTwoTwo -> GL_422_EXT+ FourTwoTwoRev -> GL_422_REV_EXT+ FourTwoTwoAverage -> GL_422_AVERAGE_EXT+ FourTwoTwoRevAverage -> GL_422_REV_AVERAGE_EXT+ YCBCR422 -> GL_YCBCR_422_APPLE+ DepthStencil -> GL_DEPTH_STENCIL unmarshalPixelFormat :: GLenum -> PixelFormat unmarshalPixelFormat x- | x == gl_COLOR_INDEX = ColorIndex- | x == gl_STENCIL_INDEX = StencilIndex- | x == gl_DEPTH_COMPONENT = DepthComponent- | x == gl_RED = Red- | x == gl_GREEN = Green- | x == gl_BLUE = Blue- | x == gl_ALPHA = Alpha- | x == gl_RG = RG- | x == gl_RGB = RGB- | x == gl_RGBA = RGBA- | x == gl_LUMINANCE = Luminance- | x == gl_LUMINANCE_ALPHA = LuminanceAlpha- | x == gl_RED_INTEGER = RedInteger- | x == gl_GREEN_INTEGER = GreenInteger- | x == gl_BLUE_INTEGER = BlueInteger- | x == gl_ALPHA_INTEGER = AlphaInteger- | x == gl_RG_INTEGER = RGInteger- | x == gl_RGB_INTEGER = RGBInteger- | x == gl_RGBA_INTEGER = RGBAInteger- | x == gl_BGR_INTEGER = BGRInteger- | x == gl_BGRA_INTEGER = BGRAInteger- | x == gl_ABGR_EXT = ABGR- | x == gl_BGR = BGR- | x == gl_BGRA = BGRA- | x == gl_CMYK_EXT = CMYK- | x == gl_CMYKA_EXT = CMYKA- | x == gl_422_EXT = FourTwoTwo- | x == gl_422_REV_EXT = FourTwoTwoRev- | x == gl_422_AVERAGE_EXT = FourTwoTwoAverage- | x == gl_422_REV_AVERAGE_EXT = FourTwoTwoRevAverage- | x == gl_YCBCR_422_APPLE = YCBCR422- | x == gl_DEPTH_STENCIL = DepthStencil+ | x == GL_COLOR_INDEX = ColorIndex+ | x == GL_STENCIL_INDEX = StencilIndex+ | x == GL_DEPTH_COMPONENT = DepthComponent+ | x == GL_RED = Red+ | x == GL_GREEN = Green+ | x == GL_BLUE = Blue+ | x == GL_ALPHA = Alpha+ | x == GL_RG = RG+ | x == GL_RGB = RGB+ | x == GL_RGBA = RGBA+ | x == GL_LUMINANCE = Luminance+ | x == GL_LUMINANCE_ALPHA = LuminanceAlpha+ | x == GL_RED_INTEGER = RedInteger+ | x == GL_GREEN_INTEGER = GreenInteger+ | x == GL_BLUE_INTEGER = BlueInteger+ | x == GL_ALPHA_INTEGER = AlphaInteger+ | x == GL_RG_INTEGER = RGInteger+ | x == GL_RGB_INTEGER = RGBInteger+ | x == GL_RGBA_INTEGER = RGBAInteger+ | x == GL_BGR_INTEGER = BGRInteger+ | x == GL_BGRA_INTEGER = BGRAInteger+ | x == GL_ABGR_EXT = ABGR+ | x == GL_BGR = BGR+ | x == GL_BGRA = BGRA+ | x == GL_CMYK_EXT = CMYK+ | x == GL_CMYKA_EXT = CMYKA+ | x == GL_422_EXT = FourTwoTwo+ | x == GL_422_REV_EXT = FourTwoTwoRev+ | x == GL_422_AVERAGE_EXT = FourTwoTwoAverage+ | x == GL_422_REV_AVERAGE_EXT = FourTwoTwoRevAverage+ | x == GL_YCBCR_422_APPLE = YCBCR422+ | x == GL_DEPTH_STENCIL = DepthStencil | otherwise = error ("unmarshalPixelFormat: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/PixelRectangles.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/ColorTable.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -21,6 +21,7 @@ colorTableRGBASizes, colorTableLuminanceSize, colorTableIntesitySize, ) where +import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr@@ -29,11 +30,10 @@ import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.PixelData-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -79,15 +79,15 @@ marshalColorTable :: ColorTable -> GLenum marshalColorTable x = case x of- ColorTable -> gl_COLOR_TABLE- PostConvolutionColorTable -> gl_POST_CONVOLUTION_COLOR_TABLE- PostColorMatrixColorTable -> gl_POST_COLOR_MATRIX_COLOR_TABLE- Texture1DColorTable -> gl_TEXTURE_1D- Texture2DColorTable -> gl_TEXTURE_2D- Texture3DColorTable -> gl_TEXTURE_3D- TextureCubeMapColorTable -> gl_TEXTURE_CUBE_MAP- TextureColorTable -> gl_TEXTURE_COLOR_TABLE_SGI- SharedTexturePalette -> gl_SHARED_TEXTURE_PALETTE_EXT+ ColorTable -> GL_COLOR_TABLE+ PostConvolutionColorTable -> GL_POST_CONVOLUTION_COLOR_TABLE+ PostColorMatrixColorTable -> GL_POST_COLOR_MATRIX_COLOR_TABLE+ Texture1DColorTable -> GL_TEXTURE_1D+ Texture2DColorTable -> GL_TEXTURE_2D+ Texture3DColorTable -> GL_TEXTURE_3D+ TextureCubeMapColorTable -> GL_TEXTURE_CUBE_MAP+ TextureColorTable -> GL_TEXTURE_COLOR_TABLE_SGI+ SharedTexturePalette -> GL_SHARED_TEXTURE_PALETTE_EXT -------------------------------------------------------------------------------- @@ -101,14 +101,14 @@ marshalProxyColorTable :: Proxy -> ColorTable -> Maybe GLenum marshalProxyColorTable NoProxy x = Just (marshalColorTable x) marshalProxyColorTable Proxy x = case x of- ColorTable -> Just gl_PROXY_COLOR_TABLE- PostConvolutionColorTable -> Just gl_PROXY_POST_CONVOLUTION_COLOR_TABLE- PostColorMatrixColorTable -> Just gl_PROXY_POST_COLOR_MATRIX_COLOR_TABLE- Texture1DColorTable -> Just gl_PROXY_TEXTURE_1D- Texture2DColorTable -> Just gl_PROXY_TEXTURE_2D- Texture3DColorTable -> Just gl_PROXY_TEXTURE_3D- TextureCubeMapColorTable -> Just gl_PROXY_TEXTURE_CUBE_MAP- TextureColorTable -> Just gl_TEXTURE_COLOR_TABLE_SGI+ ColorTable -> Just GL_PROXY_COLOR_TABLE+ PostConvolutionColorTable -> Just GL_PROXY_POST_CONVOLUTION_COLOR_TABLE+ PostColorMatrixColorTable -> Just GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE+ Texture1DColorTable -> Just GL_PROXY_TEXTURE_1D+ Texture2DColorTable -> Just GL_PROXY_TEXTURE_2D+ Texture3DColorTable -> Just GL_PROXY_TEXTURE_3D+ TextureCubeMapColorTable -> Just GL_PROXY_TEXTURE_CUBE_MAP+ TextureColorTable -> Just GL_TEXTURE_COLOR_TABLE_SGI SharedTexturePalette -> Nothing --------------------------------------------------------------------------------@@ -161,16 +161,16 @@ marshalColorTablePName :: ColorTablePName -> GLenum marshalColorTablePName x = case x of- ColorTableScale -> gl_COLOR_TABLE_SCALE- ColorTableBias -> gl_COLOR_TABLE_BIAS- ColorTableFormat -> gl_COLOR_TABLE_FORMAT- ColorTableWidth -> gl_COLOR_TABLE_WIDTH- ColorTableRedSize -> gl_COLOR_TABLE_RED_SIZE- ColorTableGreenSize -> gl_COLOR_TABLE_GREEN_SIZE- ColorTableBlueSize -> gl_COLOR_TABLE_BLUE_SIZE- ColorTableAlphaSize -> gl_COLOR_TABLE_ALPHA_SIZE- ColorTableLuminanceSize -> gl_COLOR_TABLE_LUMINANCE_SIZE- ColorTableIntensitySize -> gl_COLOR_TABLE_INTENSITY_SIZE+ ColorTableScale -> GL_COLOR_TABLE_SCALE+ ColorTableBias -> GL_COLOR_TABLE_BIAS+ ColorTableFormat -> GL_COLOR_TABLE_FORMAT+ ColorTableWidth -> GL_COLOR_TABLE_WIDTH+ ColorTableRedSize -> GL_COLOR_TABLE_RED_SIZE+ ColorTableGreenSize -> GL_COLOR_TABLE_GREEN_SIZE+ ColorTableBlueSize -> GL_COLOR_TABLE_BLUE_SIZE+ ColorTableAlphaSize -> GL_COLOR_TABLE_ALPHA_SIZE+ ColorTableLuminanceSize -> GL_COLOR_TABLE_LUMINANCE_SIZE+ ColorTableIntensitySize -> GL_COLOR_TABLE_INTENSITY_SIZE --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Convolution.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Convolution--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -25,6 +25,7 @@ convolutionFilterScale, convolutionFilterBias, ) where +import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr@@ -33,11 +34,10 @@ import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.PixelData-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -49,9 +49,9 @@ marshalConvolutionTarget :: ConvolutionTarget -> GLenum marshalConvolutionTarget x = case x of- Convolution1D -> gl_CONVOLUTION_1D- Convolution2D -> gl_CONVOLUTION_2D- Separable2D -> gl_SEPARABLE_2D+ Convolution1D -> GL_CONVOLUTION_1D+ Convolution2D -> GL_CONVOLUTION_2D+ Separable2D -> GL_SEPARABLE_2D convolutionTargetToEnableCap :: ConvolutionTarget -> EnableCap convolutionTargetToEnableCap x = case x of@@ -152,15 +152,15 @@ marshalConvolutionParameter :: ConvolutionParameter -> GLenum marshalConvolutionParameter x = case x of- ConvolutionBorderColor -> gl_CONVOLUTION_BORDER_COLOR- ConvolutionBorderMode -> gl_CONVOLUTION_BORDER_MODE- ConvolutionFilterScale -> gl_CONVOLUTION_FILTER_SCALE- ConvolutionFilterBias -> gl_CONVOLUTION_FILTER_BIAS- ConvolutionFormat -> gl_CONVOLUTION_FORMAT- ConvolutionWidth -> gl_CONVOLUTION_WIDTH- ConvolutionHeight -> gl_CONVOLUTION_HEIGHT- MaxConvolutionWidth -> gl_MAX_CONVOLUTION_WIDTH- MaxConvolutionHeight -> gl_MAX_CONVOLUTION_HEIGHT+ ConvolutionBorderColor -> GL_CONVOLUTION_BORDER_COLOR+ ConvolutionBorderMode -> GL_CONVOLUTION_BORDER_MODE+ ConvolutionFilterScale -> GL_CONVOLUTION_FILTER_SCALE+ ConvolutionFilterBias -> GL_CONVOLUTION_FILTER_BIAS+ ConvolutionFormat -> GL_CONVOLUTION_FORMAT+ ConvolutionWidth -> GL_CONVOLUTION_WIDTH+ ConvolutionHeight -> GL_CONVOLUTION_HEIGHT+ MaxConvolutionWidth -> GL_MAX_CONVOLUTION_WIDTH+ MaxConvolutionHeight -> GL_MAX_CONVOLUTION_HEIGHT -------------------------------------------------------------------------------- @@ -198,15 +198,15 @@ marshalConvolutionBorderMode' :: ConvolutionBorderMode' -> GLint marshalConvolutionBorderMode' x = fromIntegral $ case x of- Reduce' -> gl_REDUCE- ConstantBorder' -> gl_CONSTANT_BORDER- ReplicateBorder' -> gl_REPLICATE_BORDER+ Reduce' -> GL_REDUCE+ ConstantBorder' -> GL_CONSTANT_BORDER+ ReplicateBorder' -> GL_REPLICATE_BORDER unmarshalConvolutionBorderMode' :: GLint -> ConvolutionBorderMode' unmarshalConvolutionBorderMode' x- | y == gl_REDUCE = Reduce'- | y == gl_CONSTANT_BORDER = ConstantBorder'- | y == gl_REPLICATE_BORDER = ReplicateBorder'+ | y == GL_REDUCE = Reduce'+ | y == GL_CONSTANT_BORDER = ConstantBorder'+ | y == GL_REPLICATE_BORDER = ReplicateBorder' | otherwise = error ("unmarshalConvolutionBorderMode': illegal value " ++ show x) where y = fromIntegral x
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Histogram.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Histogram--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,6 +18,7 @@ histogramRGBASizes, histogramLuminanceSize ) where +import Data.StateVar import Foreign.Marshal.Utils import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.PeekPoke@@ -25,10 +26,9 @@ import Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable import Graphics.Rendering.OpenGL.GL.PixelRectangles.Reset import Graphics.Rendering.OpenGL.GL.PixelRectangles.Sink-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -38,8 +38,8 @@ marshalHistogramTarget :: HistogramTarget -> GLenum marshalHistogramTarget x = case x of- Histogram -> gl_HISTOGRAM- ProxyHistogram -> gl_PROXY_HISTOGRAM+ Histogram -> GL_HISTOGRAM+ ProxyHistogram -> GL_PROXY_HISTOGRAM proxyToHistogramTarget :: Proxy -> HistogramTarget proxyToHistogramTarget x = case x of@@ -106,14 +106,14 @@ marshalGetHistogramParameterPName :: GetHistogramParameterPName -> GLenum marshalGetHistogramParameterPName x = case x of- HistogramWidth -> gl_HISTOGRAM_WIDTH- HistogramFormat -> gl_HISTOGRAM_FORMAT- HistogramRedSize -> gl_HISTOGRAM_RED_SIZE- HistogramGreenSize -> gl_HISTOGRAM_GREEN_SIZE- HistogramBlueSize -> gl_HISTOGRAM_BLUE_SIZE- HistogramAlphaSize -> gl_HISTOGRAM_ALPHA_SIZE- HistogramLuminanceSize -> gl_HISTOGRAM_LUMINANCE_SIZE- HistogramSink -> gl_HISTOGRAM_SINK+ HistogramWidth -> GL_HISTOGRAM_WIDTH+ HistogramFormat -> GL_HISTOGRAM_FORMAT+ HistogramRedSize -> GL_HISTOGRAM_RED_SIZE+ HistogramGreenSize -> GL_HISTOGRAM_GREEN_SIZE+ HistogramBlueSize -> GL_HISTOGRAM_BLUE_SIZE+ HistogramAlphaSize -> GL_HISTOGRAM_ALPHA_SIZE+ HistogramLuminanceSize -> GL_HISTOGRAM_LUMINANCE_SIZE+ HistogramSink -> GL_HISTOGRAM_SINK --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Minmax.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Minmax--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,15 +17,15 @@ minmax, getMinmax, resetMinmax ) where +import Data.StateVar import Foreign.Marshal.Utils import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.PixelData import Graphics.Rendering.OpenGL.GL.PixelRectangles.Reset import Graphics.Rendering.OpenGL.GL.PixelRectangles.Sink-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -34,7 +34,7 @@ marshalMinmaxTarget :: MinmaxTarget -> GLenum marshalMinmaxTarget x = case x of- Minmax -> gl_MINMAX+ Minmax -> GL_MINMAX -------------------------------------------------------------------------------- @@ -74,8 +74,8 @@ marshalGetMinmaxParameterPName :: GetMinmaxParameterPName -> GLenum marshalGetMinmaxParameterPName x = case x of- MinmaxFormat -> gl_MINMAX_FORMAT- MinmaxSink -> gl_MINMAX_SINK+ MinmaxFormat -> GL_MINMAX_FORMAT+ MinmaxSink -> GL_MINMAX_SINK --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelMap.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelMap--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -21,14 +21,14 @@ ) where import Data.List+import Data.StateVar import Foreign.ForeignPtr import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -47,16 +47,16 @@ marshalPixelMapTarget :: PixelMapTarget -> GLenum marshalPixelMapTarget x = case x of- IToI -> gl_PIXEL_MAP_I_TO_I- SToS -> gl_PIXEL_MAP_S_TO_S- IToR -> gl_PIXEL_MAP_I_TO_R- IToG -> gl_PIXEL_MAP_I_TO_G- IToB -> gl_PIXEL_MAP_I_TO_B- IToA -> gl_PIXEL_MAP_I_TO_A- RToR -> gl_PIXEL_MAP_R_TO_R- GToG -> gl_PIXEL_MAP_G_TO_G- BToB -> gl_PIXEL_MAP_B_TO_B- AToA -> gl_PIXEL_MAP_A_TO_A+ IToI -> GL_PIXEL_MAP_I_TO_I+ SToS -> GL_PIXEL_MAP_S_TO_S+ IToR -> GL_PIXEL_MAP_I_TO_R+ IToG -> GL_PIXEL_MAP_I_TO_G+ IToB -> GL_PIXEL_MAP_I_TO_B+ IToA -> GL_PIXEL_MAP_I_TO_A+ RToR -> GL_PIXEL_MAP_R_TO_R+ GToG -> GL_PIXEL_MAP_G_TO_G+ BToB -> GL_PIXEL_MAP_B_TO_B+ AToA -> GL_PIXEL_MAP_A_TO_A pixelMapTargetToGetPName :: PixelMapTarget -> PName1I pixelMapTargetToGetPName x = case x of
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelStorage.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelStorage--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,10 +18,10 @@ skipPixels, rowAlignment, imageHeight, skipImages ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -52,22 +52,22 @@ marshalPixelStore :: PixelStore -> GLenum marshalPixelStore x = case x of- UnpackSwapBytes -> gl_UNPACK_SWAP_BYTES- UnpackLSBFirst -> gl_UNPACK_LSB_FIRST- UnpackRowLength -> gl_UNPACK_ROW_LENGTH- UnpackSkipRows -> gl_UNPACK_SKIP_ROWS- UnpackSkipPixels -> gl_UNPACK_SKIP_PIXELS- UnpackAlignment -> gl_UNPACK_ALIGNMENT- PackSwapBytes -> gl_PACK_SWAP_BYTES- PackLSBFirst -> gl_PACK_LSB_FIRST- PackRowLength -> gl_PACK_ROW_LENGTH- PackSkipRows -> gl_PACK_SKIP_ROWS- PackSkipPixels -> gl_PACK_SKIP_PIXELS- PackAlignment -> gl_PACK_ALIGNMENT- PackSkipImages -> gl_PACK_SKIP_IMAGES- PackImageHeight -> gl_PACK_IMAGE_HEIGHT- UnpackSkipImages -> gl_UNPACK_SKIP_IMAGES- UnpackImageHeight -> gl_UNPACK_IMAGE_HEIGHT+ UnpackSwapBytes -> GL_UNPACK_SWAP_BYTES+ UnpackLSBFirst -> GL_UNPACK_LSB_FIRST+ UnpackRowLength -> GL_UNPACK_ROW_LENGTH+ UnpackSkipRows -> GL_UNPACK_SKIP_ROWS+ UnpackSkipPixels -> GL_UNPACK_SKIP_PIXELS+ UnpackAlignment -> GL_UNPACK_ALIGNMENT+ PackSwapBytes -> GL_PACK_SWAP_BYTES+ PackLSBFirst -> GL_PACK_LSB_FIRST+ PackRowLength -> GL_PACK_ROW_LENGTH+ PackSkipRows -> GL_PACK_SKIP_ROWS+ PackSkipPixels -> GL_PACK_SKIP_PIXELS+ PackAlignment -> GL_PACK_ALIGNMENT+ PackSkipImages -> GL_PACK_SKIP_IMAGES+ PackImageHeight -> GL_PACK_IMAGE_HEIGHT+ UnpackSkipImages -> GL_UNPACK_SKIP_IMAGES+ UnpackImageHeight -> GL_UNPACK_IMAGE_HEIGHT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/PixelTransfer.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelTransfer--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,11 +19,11 @@ rgbaScale, rgbaBias ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -61,36 +61,36 @@ marshalPixelTransfer :: PixelTransfer -> GLenum marshalPixelTransfer x = case x of- MapColor -> gl_MAP_COLOR- MapStencil -> gl_MAP_STENCIL- IndexShift -> gl_INDEX_SHIFT- IndexOffset -> gl_INDEX_OFFSET- RedScale -> gl_RED_SCALE- RedBias -> gl_RED_BIAS- GreenScale -> gl_GREEN_SCALE- GreenBias -> gl_GREEN_BIAS- BlueScale -> gl_BLUE_SCALE- BlueBias -> gl_BLUE_BIAS- AlphaScale -> gl_ALPHA_SCALE- AlphaBias -> gl_ALPHA_BIAS- DepthScale -> gl_DEPTH_SCALE- DepthBias -> gl_DEPTH_BIAS- PostConvolutionRedScale -> gl_POST_CONVOLUTION_RED_SCALE- PostConvolutionGreenScale -> gl_POST_CONVOLUTION_GREEN_SCALE- PostConvolutionBlueScale -> gl_POST_CONVOLUTION_BLUE_SCALE- PostConvolutionAlphaScale -> gl_POST_CONVOLUTION_ALPHA_SCALE- PostConvolutionRedBias -> gl_POST_CONVOLUTION_RED_BIAS- PostConvolutionGreenBias -> gl_POST_CONVOLUTION_GREEN_BIAS- PostConvolutionBlueBias -> gl_POST_CONVOLUTION_BLUE_BIAS- PostConvolutionAlphaBias -> gl_POST_CONVOLUTION_ALPHA_BIAS- PostColorMatrixRedScale -> gl_POST_COLOR_MATRIX_RED_SCALE- PostColorMatrixGreenScale -> gl_POST_COLOR_MATRIX_GREEN_SCALE- PostColorMatrixBlueScale -> gl_POST_COLOR_MATRIX_BLUE_SCALE- PostColorMatrixAlphaScale -> gl_POST_COLOR_MATRIX_ALPHA_SCALE- PostColorMatrixRedBias -> gl_POST_COLOR_MATRIX_RED_BIAS- PostColorMatrixGreenBias -> gl_POST_COLOR_MATRIX_GREEN_BIAS- PostColorMatrixBlueBias -> gl_POST_COLOR_MATRIX_BLUE_BIAS- PostColorMatrixAlphaBias -> gl_POST_COLOR_MATRIX_ALPHA_BIAS+ MapColor -> GL_MAP_COLOR+ MapStencil -> GL_MAP_STENCIL+ IndexShift -> GL_INDEX_SHIFT+ IndexOffset -> GL_INDEX_OFFSET+ RedScale -> GL_RED_SCALE+ RedBias -> GL_RED_BIAS+ GreenScale -> GL_GREEN_SCALE+ GreenBias -> GL_GREEN_BIAS+ BlueScale -> GL_BLUE_SCALE+ BlueBias -> GL_BLUE_BIAS+ AlphaScale -> GL_ALPHA_SCALE+ AlphaBias -> GL_ALPHA_BIAS+ DepthScale -> GL_DEPTH_SCALE+ DepthBias -> GL_DEPTH_BIAS+ PostConvolutionRedScale -> GL_POST_CONVOLUTION_RED_SCALE+ PostConvolutionGreenScale -> GL_POST_CONVOLUTION_GREEN_SCALE+ PostConvolutionBlueScale -> GL_POST_CONVOLUTION_BLUE_SCALE+ PostConvolutionAlphaScale -> GL_POST_CONVOLUTION_ALPHA_SCALE+ PostConvolutionRedBias -> GL_POST_CONVOLUTION_RED_BIAS+ PostConvolutionGreenBias -> GL_POST_CONVOLUTION_GREEN_BIAS+ PostConvolutionBlueBias -> GL_POST_CONVOLUTION_BLUE_BIAS+ PostConvolutionAlphaBias -> GL_POST_CONVOLUTION_ALPHA_BIAS+ PostColorMatrixRedScale -> GL_POST_COLOR_MATRIX_RED_SCALE+ PostColorMatrixGreenScale -> GL_POST_COLOR_MATRIX_GREEN_SCALE+ PostColorMatrixBlueScale -> GL_POST_COLOR_MATRIX_BLUE_SCALE+ PostColorMatrixAlphaScale -> GL_POST_COLOR_MATRIX_ALPHA_SCALE+ PostColorMatrixRedBias -> GL_POST_COLOR_MATRIX_RED_BIAS+ PostColorMatrixGreenBias -> GL_POST_COLOR_MATRIX_GREEN_BIAS+ PostColorMatrixBlueBias -> GL_POST_COLOR_MATRIX_BLUE_BIAS+ PostColorMatrixAlphaBias -> GL_POST_COLOR_MATRIX_ALPHA_BIAS --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Rasterization.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Rasterization--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,12 +18,12 @@ ) where import Control.Monad+import Data.StateVar import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.PixelData import Graphics.Rendering.OpenGL.GL.PixelFormat import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Reset.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Reset--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ ) where import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Sink.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixelRectangles.Sink--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ ) where import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PixellikeObject.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PixellikeObject--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,15 +15,15 @@ PixellikeObjectTarget(pixellikeObjTarParam), ) where +import Data.StateVar import Foreign.Marshal.Utils import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjectAttachment import Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferTarget import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.Specification import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -44,12 +44,12 @@ instance PixellikeObjectTarget RenderbufferTarget where marshalPixellikeOT _ x = case x of- RedSize -> gl_RENDERBUFFER_RED_SIZE- BlueSize -> gl_RENDERBUFFER_BLUE_SIZE- GreenSize -> gl_RENDERBUFFER_GREEN_SIZE- AlphaSize -> gl_RENDERBUFFER_ALPHA_SIZE- DepthSize -> gl_RENDERBUFFER_DEPTH_SIZE- StencilSize -> gl_RENDERBUFFER_STENCIL_SIZE+ RedSize -> GL_RENDERBUFFER_RED_SIZE+ BlueSize -> GL_RENDERBUFFER_BLUE_SIZE+ GreenSize -> GL_RENDERBUFFER_GREEN_SIZE+ AlphaSize -> GL_RENDERBUFFER_ALPHA_SIZE+ DepthSize -> GL_RENDERBUFFER_DEPTH_SIZE+ StencilSize -> GL_RENDERBUFFER_STENCIL_SIZE pixObjTarQueryFunc t = getRBParameteriv t id data FramebufferTargetAttachment =@@ -57,12 +57,12 @@ instance PixellikeObjectTarget FramebufferTargetAttachment where marshalPixellikeOT _ x = case x of- RedSize -> gl_FRAMEBUFFER_ATTACHMENT_RED_SIZE- BlueSize -> gl_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE- GreenSize -> gl_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE- AlphaSize -> gl_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE- DepthSize -> gl_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE- StencilSize -> gl_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE+ RedSize -> GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE+ BlueSize -> GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE+ GreenSize -> GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE+ AlphaSize -> GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE+ DepthSize -> GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE+ StencilSize -> GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE pixObjTarQueryFunc (FramebufferTargetAttachment fbt fba) = getFBAParameteriv fbt fba id @@ -70,12 +70,12 @@ instance QueryableTextureTarget t => PixellikeObjectTarget (TextureTargetFull t) where marshalPixellikeOT _ x = case x of- RedSize -> gl_TEXTURE_RED_SIZE- BlueSize -> gl_TEXTURE_BLUE_SIZE- GreenSize -> gl_TEXTURE_GREEN_SIZE- AlphaSize -> gl_TEXTURE_ALPHA_SIZE- DepthSize -> gl_TEXTURE_DEPTH_SIZE- StencilSize -> gl_TEXTURE_STENCIL_SIZE+ RedSize -> GL_TEXTURE_RED_SIZE+ BlueSize -> GL_TEXTURE_BLUE_SIZE+ GreenSize -> GL_TEXTURE_GREEN_SIZE+ AlphaSize -> GL_TEXTURE_ALPHA_SIZE+ DepthSize -> GL_TEXTURE_DEPTH_SIZE+ StencilSize -> GL_TEXTURE_STENCIL_SIZE pixObjTarQueryFunc (TextureTargetFull t level) p = with 0 $ \buf -> do glGetTexLevelParameteriv (marshalQueryableTextureTarget t) level p buf
src/Graphics/Rendering/OpenGL/GL/PointParameter.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PointParameter--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ ) where import Foreign.Ptr-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -30,10 +30,10 @@ marshalPointParameter :: PointParameter -> GLenum marshalPointParameter x = case x of- PointSizeMin -> gl_POINT_SIZE_MIN- PointSizeMax -> gl_POINT_SIZE_MAX- PointFadeThresholdSize -> gl_POINT_FADE_THRESHOLD_SIZE- PointDistanceAttenuation -> gl_POINT_DISTANCE_ATTENUATION+ PointSizeMin -> GL_POINT_SIZE_MIN+ PointSizeMax -> GL_POINT_SIZE_MAX+ PointFadeThresholdSize -> GL_POINT_FADE_THRESHOLD_SIZE+ PointDistanceAttenuation -> GL_POINT_DISTANCE_ATTENUATION --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Points.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Points--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -33,12 +33,12 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Array import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.PointParameter import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PolygonMode.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PolygonMode--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ PolygonMode(..), marshalPolygonMode, unmarshalPolygonMode ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -29,13 +29,13 @@ marshalPolygonMode :: PolygonMode -> GLenum marshalPolygonMode x = case x of- Point -> gl_POINT- Line -> gl_LINE- Fill -> gl_FILL+ Point -> GL_POINT+ Line -> GL_LINE+ Fill -> GL_FILL unmarshalPolygonMode :: GLenum -> PolygonMode unmarshalPolygonMode x- | x == gl_POINT = Point- | x == gl_LINE = Line- | x == gl_FILL = Fill+ | x == GL_POINT = Point+ | x == GL_LINE = Line+ | x == GL_FILL = Fill | otherwise = error ("unmarshalPolygonMode: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/Polygons.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Polygons--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,6 +20,7 @@ ) where import Control.Monad+import Data.StateVar import Foreign.ForeignPtr import Foreign.Marshal.Array import Foreign.Ptr@@ -29,8 +30,7 @@ import Graphics.Rendering.OpenGL.GL.PolygonMode import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.SavingState-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/PrimitiveMode.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PrimitiveMode--- Copyright : (c) Sven Panne 2002-2013, Tobias Markus 2015+-- Copyright : (c) Sven Panne 2002-2019, Tobias Markus 2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,12 +17,15 @@ -- * Primitive Modes PrimitiveMode(..), -- * Patches (Tessellation)- patchVertices, maxPatchVertices+ patchVertices, maxPatchVertices,+ patchDefaultOuterLevel, patchDefaultInnerLevel, maxTessGenLevel ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar+import Foreign.Marshal.Array+import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils.PName-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -82,10 +85,39 @@ -- 'patchVertices' is set to a value less than or equal to zero or greater -- than the implementation-dependent maximum value 'maxPatchVertices'. -patchVertices :: SettableStateVar GLint-patchVertices = makeSettableStateVar $ glPatchParameteri gl_PATCH_VERTICES+patchVertices :: StateVar GLsizei+patchVertices =+ makeStateVar (getSizei1 id GetPatchVertices)+ (glPatchParameteri GL_PATCH_VERTICES . fromIntegral) -- | Contains the maximumum number of vertices in a single patch. -maxPatchVertices :: GettableStateVar GLint-maxPatchVertices = makeGettableStateVar $ getInteger1 id GetMaxPatchVertices+maxPatchVertices :: GettableStateVar GLsizei+maxPatchVertices = makeGettableStateVar $ getSizei1 id GetMaxPatchVertices++-- | Contains the four default outer tessellation levels to be used when no+-- tessellation control shader is present.++patchDefaultOuterLevel :: StateVar (GLfloat, GLfloat, GLfloat, GLfloat)+patchDefaultOuterLevel =+ makeStateVar+ (getFloat4 (,,,) GetPatchDefaultOuterLevel)+ (\(l0, l1, l2, l3) -> allocaArray 4 $ \ptr -> do+ poke4 ptr l0 l1 l2 l3+ glPatchParameterfv GL_PATCH_DEFAULT_OUTER_LEVEL ptr)++-- | Contains the two default inner tessellation levels to be used when no+-- tessellation control shader is present.++patchDefaultInnerLevel :: StateVar (GLfloat, GLfloat)+patchDefaultInnerLevel =+ makeStateVar+ (getFloat2 (,) GetPatchDefaultInnerLevel)+ (\(l0, l1) -> allocaArray 2 $ \ptr -> do+ poke2 ptr l0 l1+ glPatchParameterfv GL_PATCH_DEFAULT_INNER_LEVEL ptr)++-- | Contains the maximum allowed tessellation level.++maxTessGenLevel :: GettableStateVar GLsizei+maxTessGenLevel = makeGettableStateVar $ getSizei1 id GetMaxTessGenLevel
src/Graphics/Rendering/OpenGL/GL/PrimitiveModeInternal.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,36 +17,36 @@ marshalPrimitiveMode, unmarshalPrimitiveMode ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL import Graphics.Rendering.OpenGL.GL.PrimitiveMode -------------------------------------------------------------------------------- marshalPrimitiveMode :: PrimitiveMode -> GLenum marshalPrimitiveMode x = case x of- Points -> gl_POINTS- Lines -> gl_LINES- LineLoop -> gl_LINE_LOOP- LineStrip -> gl_LINE_STRIP- Triangles -> gl_TRIANGLES- TriangleStrip -> gl_TRIANGLE_STRIP- TriangleFan -> gl_TRIANGLE_FAN- Quads -> gl_QUADS- QuadStrip -> gl_QUAD_STRIP- Polygon -> gl_POLYGON- Patches -> gl_PATCHES+ Points -> GL_POINTS+ Lines -> GL_LINES+ LineLoop -> GL_LINE_LOOP+ LineStrip -> GL_LINE_STRIP+ Triangles -> GL_TRIANGLES+ TriangleStrip -> GL_TRIANGLE_STRIP+ TriangleFan -> GL_TRIANGLE_FAN+ Quads -> GL_QUADS+ QuadStrip -> GL_QUAD_STRIP+ Polygon -> GL_POLYGON+ Patches -> GL_PATCHES unmarshalPrimitiveMode :: GLenum -> PrimitiveMode unmarshalPrimitiveMode x- | x == gl_POINTS = Points- | x == gl_LINES = Lines- | x == gl_LINE_LOOP = LineLoop- | x == gl_LINE_STRIP = LineStrip- | x == gl_TRIANGLES = Triangles- | x == gl_TRIANGLE_STRIP = TriangleStrip- | x == gl_TRIANGLE_FAN = TriangleFan- | x == gl_QUADS = Quads- | x == gl_QUAD_STRIP = QuadStrip- | x == gl_POLYGON = Polygon- | x == gl_PATCHES = Patches+ | x == GL_POINTS = Points+ | x == GL_LINES = Lines+ | x == GL_LINE_LOOP = LineLoop+ | x == GL_LINE_STRIP = LineStrip+ | x == GL_TRIANGLES = Triangles+ | x == GL_TRIANGLE_STRIP = TriangleStrip+ | x == GL_TRIANGLE_FAN = TriangleFan+ | x == GL_QUADS = Quads+ | x == GL_QUAD_STRIP = QuadStrip+ | x == GL_POLYGON = Polygon+ | x == GL_PATCHES = Patches | otherwise = error ("unmarshalPrimitiveMode: illegal value " ++ show x)
src/Graphics/Rendering/OpenGL/GL/QueryObject.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.QueryObject--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,10 +17,13 @@ QueryObject(..), noQueryObject ) where -import Foreign.Marshal.Array+import Control.Monad.IO.Class+import Data.ObjectName+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- @@ -33,14 +36,17 @@ -------------------------------------------------------------------------------- instance ObjectName QueryObject where- isObjectName = fmap unmarshalGLboolean . glIsQuery . queryID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsQuery . queryID deleteObjectNames queryObjects =- withArrayLen (map queryID queryObjects) $+ liftIO . withArrayLen (map queryID queryObjects) $ glDeleteQueries . fromIntegral instance GeneratableObjectName QueryObject where genObjectNames n =- allocaArray n $ \buf -> do+ liftIO . allocaArray n $ \buf -> do glGenQueries (fromIntegral n) buf fmap (map QueryObject) $ peekArray n buf++instance CanBeLabeled QueryObject where+ objectLabel = objectNameLabel GL_QUERY . queryID
src/Graphics/Rendering/OpenGL/GL/QueryObjects.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.QueryObjects--- Copyright : (c) Sven Panne, Lars Corbijn 2004-2013+-- Copyright : (c) Sven Panne 2004-2019, Lars Corbijn 2004-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -30,6 +30,7 @@ timestampQuery, timestamp ) where +import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr@@ -39,8 +40,7 @@ import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryObject import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -63,13 +63,13 @@ marshalQueryTarget :: QueryTarget -> (GLenum, QueryIndex) marshalQueryTarget x = case x of- SamplesPassed -> (gl_SAMPLES_PASSED, 0)- AnySamplesPassed -> (gl_ANY_SAMPLES_PASSED, 0)- AnySamplesPassedConservative -> (gl_ANY_SAMPLES_PASSED_CONSERVATIVE, 0)- TimeElapsed -> (gl_TIME_ELAPSED, 0)- PrimitivesGenerated n -> (gl_PRIMITIVES_GENERATED, n)+ SamplesPassed -> (GL_SAMPLES_PASSED, 0)+ AnySamplesPassed -> (GL_ANY_SAMPLES_PASSED, 0)+ AnySamplesPassedConservative -> (GL_ANY_SAMPLES_PASSED_CONSERVATIVE, 0)+ TimeElapsed -> (GL_TIME_ELAPSED, 0)+ PrimitivesGenerated n -> (GL_PRIMITIVES_GENERATED, n) TransformFeedbackPrimitivesWritten n ->- (gl_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, n)+ (GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, n) -------------------------------------------------------------------------------- @@ -96,8 +96,8 @@ marshalGetQueryPName :: GetQueryPName -> GLenum marshalGetQueryPName x = case x of- QueryCounterBits -> gl_QUERY_COUNTER_BITS- CurrentQuery -> gl_CURRENT_QUERY+ QueryCounterBits -> GL_QUERY_COUNTER_BITS+ CurrentQuery -> GL_CURRENT_QUERY -------------------------------------------------------------------------------- @@ -129,8 +129,8 @@ marshalGetQueryObjectPName :: GetQueryObjectPName -> GLenum marshalGetQueryObjectPName x = case x of- QueryResultAvailable -> gl_QUERY_RESULT_AVAILABLE- QueryResult -> gl_QUERY_RESULT+ QueryResultAvailable -> GL_QUERY_RESULT_AVAILABLE+ QueryResult -> GL_QUERY_RESULT -------------------------------------------------------------------------------- @@ -166,7 +166,7 @@ -- state and the framebuffer have been fully realized timestampQuery :: QueryObject -> IO ()-timestampQuery q = glQueryCounter (queryID q) gl_TIMESTAMP+timestampQuery q = glQueryCounter (queryID q) GL_TIMESTAMP -- | Contains the GL time after all previous commands have reached the GL server -- but have not yet necessarily executed.
src/Graphics/Rendering/OpenGL/GL/QueryUtils.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.QueryUtils--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,13 +20,20 @@ lightIndexToEnum, modelviewIndexToEnum, modelviewEnumToIndex, - maybeNullPtr+ maybeNullPtr,++ objectNameLabel, objectPtrLabel, maxLabelLength ) where -import Foreign.Ptr+import Data.StateVar+import Foreign.C.String ( peekCStringLen, withCStringLen )+import Foreign.Ptr ( Ptr, nullPtr )+import Foreign.Marshal.Alloc ( alloca )+import Foreign.Marshal.Array ( allocaArray )+import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils.PName import Graphics.Rendering.OpenGL.GL.QueryUtils.VertexAttrib-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -34,7 +41,7 @@ lightIndexToEnum :: GLsizei -> Maybe GLenum lightIndexToEnum i- | 0 <= i && i <= maxLightIndex = Just (gl_LIGHT0 + fromIntegral i)+ | 0 <= i && i <= maxLightIndex = Just (GL_LIGHT0 + fromIntegral i) | otherwise = Nothing maxLightIndex :: GLsizei@@ -45,17 +52,17 @@ -- 0x1700, 0x850a, and 0x8722 through 0x873f are reserved for modelview matrices modelviewIndexToEnum :: GLsizei -> Maybe GLenum-modelviewIndexToEnum 0 = Just gl_MODELVIEW-modelviewIndexToEnum 1 = Just gl_MODELVIEW1_ARB+modelviewIndexToEnum 0 = Just GL_MODELVIEW+modelviewIndexToEnum 1 = Just GL_MODELVIEW1_ARB modelviewIndexToEnum i- | 2 <= i && i <= 31 = Just (gl_MODELVIEW2_ARB - 2 + fromIntegral i)+ | 2 <= i && i <= 31 = Just (GL_MODELVIEW2_ARB - 2 + fromIntegral i) | otherwise = Nothing modelviewEnumToIndex :: GLenum -> Maybe GLsizei modelviewEnumToIndex x- | x == gl_MODELVIEW = Just 0- | x == gl_MODELVIEW1_ARB = Just 1- | gl_MODELVIEW2_ARB <= x && x <= gl_MODELVIEW31_ARB = Just (fromIntegral (x - (gl_MODELVIEW2_ARB - 2)))+ | x == GL_MODELVIEW = Just 0+ | x == GL_MODELVIEW1_ARB = Just 1+ | GL_MODELVIEW2_ARB <= x && x <= GL_MODELVIEW31_ARB = Just (fromIntegral (x - (GL_MODELVIEW2_ARB - 2))) | otherwise = Nothing --------------------------------------------------------------------------------@@ -63,3 +70,37 @@ maybeNullPtr :: b -> (Ptr a -> b) -> Ptr a -> b maybeNullPtr n f ptr | ptr == nullPtr = n | otherwise = f ptr++--------------------------------------------------------------------------------++objectNameLabel :: GLuint -> GLenum -> StateVar (Maybe String)+objectNameLabel name ident =+ makeStateVar+ (getObjectLabelWith (glGetObjectLabel ident name))+ (setObjectLabelWith (glObjectLabel ident name))++objectPtrLabel :: Ptr () -> StateVar (Maybe String)+objectPtrLabel ptr =+ makeStateVar+ (getObjectLabelWith (glGetObjectPtrLabel ptr))+ (setObjectLabelWith (glObjectPtrLabel ptr))++getObjectLabelWith :: (GLsizei -> Ptr GLsizei -> Ptr GLchar -> IO ())+ -> IO (Maybe String)+getObjectLabelWith getLabel = do+ maxLen <- get maxLabelLength+ alloca $ \lenBuf ->+ allocaArray (fromIntegral maxLen) $ \labelBuf -> do+ getLabel maxLen lenBuf labelBuf+ actualLen <- peek1 fromIntegral lenBuf+ label <- peekCStringLen (labelBuf, actualLen)+ return $ if label == "" then Nothing else Just label++setObjectLabelWith :: (GLsizei -> Ptr GLchar -> IO ()) -> Maybe String -> IO ()+setObjectLabelWith setLabel =+ maybe (set (nullPtr, (0 :: Int))) (flip withCStringLen set)+ where set (labelBuf, len) = setLabel (fromIntegral len) labelBuf++maxLabelLength :: GettableStateVar GLsizei+maxLabelLength =+ makeGettableStateVar (getSizei1 id GetMaxLabelLength)
src/Graphics/Rendering/OpenGL/GL/QueryUtils/PName.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.QueryUtils.PName--- Copyright : (c) Sven Panne 2002-2009, Lars Corbijn 2013+-- Copyright : (c) Sven Panne 2002-2019, Lars Corbijn 2013 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>, Jason Dagit <dagitj@gmail.com>@@ -40,7 +40,7 @@ import Foreign.Storable ( Storable(peek) ) import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -113,7 +113,7 @@ getClampd1 = get1 getDoublev -- | Helper function for the get*1 functions.-get1 :: (Storable b, Storable c, GetPName p)+get1 :: (Storable b, Storable c) => (p -> Ptr c -> IO ()) -> (b -> a) -- ^ Conversion from the casted value to the return value -> p -> IO a@@ -138,7 +138,7 @@ getInteger641i = get1i getInteger64iv -- Indexed helper-get1i :: (Storable b, Storable c, GetPName p)+get1i :: (Storable b, Storable c) => (p -> GLuint -> Ptr c -> IO ()) -> (b -> a) -- ^ Conversion from the casted value to the return value -> p -> GLuint -> IO a@@ -175,7 +175,7 @@ getClampd2 = get2 getDoublev -- | Helper function for the get*2 functions.-get2 :: (Storable b, Storable c, GetPName p)+get2 :: (Storable b, Storable c) => (p -> Ptr c -> IO ()) -> (b -> b -> a) -- ^ Conversion from the casted value to the return value -> p -> IO a@@ -212,7 +212,7 @@ getClampd3 = get3 getDoublev -- | Helper function for the get*3 functions.-get3 :: (Storable b, Storable c, GetPName p)+get3 :: (Storable b, Storable c) => (p -> Ptr c -> IO ()) -> (b -> b -> b -> a) -- ^ Conversion from the casted value to the return value -> p -> IO a@@ -249,7 +249,7 @@ getClampd4 = get4 getDoublev -- | Helper function for the get*4 functions.-get4 :: (Storable b, Storable c, GetPName p)+get4 :: (Storable b, Storable c) => (p -> Ptr c -> IO ()) -> (b -> b -> b -> b -> a) -- ^ Conversion from the casted value to the return value -> p -> IO a@@ -271,7 +271,7 @@ getSizei4i = get4i getIntegeriv -- | Helper function for the get*4 functions.-get4i :: (Storable b, Storable c, GetPName p)+get4i :: (Storable b, Storable c) => (p -> GLuint -> Ptr c -> IO ()) -> (b -> b -> b -> b -> a) -- ^ Conversion from the casted value to the return value -> p -> GLuint -> IO a@@ -370,8 +370,9 @@ | GetMaxVertexAttribs -- ^ sizei | GetMaxVaryingFloats -- ^ sizei -- tessellation- | GetMaxPatchVertices -- ^ int- | GetMaxTessellationLevel -- ^ int+ | GetPatchVertices -- ^ sizei+ | GetMaxPatchVertices -- ^ sizei+ | GetMaxTessGenLevel -- ^ sizei -- coordtrans | GetMatrixMode -- ^ enum | GetModelviewStackDepth -- ^ sizei@@ -478,6 +479,7 @@ | GetIndexWritemask -- ^ int | GetDepthWritemask -- ^ bool | GetStencilWritemask -- ^ bool+ | GetStencilBackWritemask -- ^ bool | GetStencilClearValue -- ^ int -- Program | GetCurrentProgram -- ^ int@@ -494,11 +496,17 @@ | GetSampleCoverageInvert -- ^ bool | GetAlphaTestFunc -- ^ enum | GetStencilFunc -- ^ enum+ | GetStencilBackFunc -- ^ enum | GetStencilValueMask -- ^ int+ | GetStencilBackValueMask -- ^ int | GetStencilRef -- ^ int+ | GetStencilBackRef -- ^ int | GetStencilFail -- ^ enum+ | GetStencilBackFail -- ^ enum | GetStencilPassDepthFail -- ^ enum+ | GetStencilBackPassDepthFail -- ^ enum | GetStencilPassDepthPass -- ^ enum+ | GetStencilBackPassDepthPass -- ^ enum | GetActiveStencilFace -- ^ enum | GetLogicOpMode -- ^ enum | GetBlendDst -- ^ enum@@ -561,285 +569,298 @@ | GetDebugLoggedMessages -- ^ int | GetDebugNextLoggedMessageLength -- ^ int | GetMaxDebugGroupStackDepth -- ^ int+ | GetMaxLabelLength -- ^ int+ -- Extensions+ | GetNumExtensions -- ^ uint instance GetPName1I PName1I where instance GetPName PName1I where marshalGetPName pn = case pn of- GetEdgeFlag -> Just gl_EDGE_FLAG- GetRGBAMode -> Just gl_RGBA_MODE- GetCurrentIndex -> Just gl_CURRENT_INDEX- GetMaxTextureUnits -> Just gl_MAX_TEXTURE_UNITS+ GetEdgeFlag -> Just GL_EDGE_FLAG+ GetRGBAMode -> Just GL_RGBA_MODE+ GetCurrentIndex -> Just GL_CURRENT_INDEX+ GetMaxTextureUnits -> Just GL_MAX_TEXTURE_UNITS -- displaylist- GetListIndex -> Just gl_LIST_INDEX- GetListMode -> Just gl_LIST_MODE- GetMaxListNesting -> Just gl_MAX_LIST_NESTING- GetListBase -> Just gl_LIST_BASE+ GetListIndex -> Just GL_LIST_INDEX+ GetListMode -> Just GL_LIST_MODE+ GetMaxListNesting -> Just GL_MAX_LIST_NESTING+ GetListBase -> Just GL_LIST_BASE -- rendermode- GetRenderMode -> Just gl_RENDER_MODE+ GetRenderMode -> Just GL_RENDER_MODE -- framebufferbinding- GetDrawFramebufferBinding -> Just gl_DRAW_FRAMEBUFFER_BINDING- GetReadFramebufferBinding -> Just gl_READ_FRAMEBUFFER_BINDING- GetFramebufferBinding -> Just gl_FRAMEBUFFER_BINDING+ GetDrawFramebufferBinding -> Just GL_DRAW_FRAMEBUFFER_BINDING+ GetReadFramebufferBinding -> Just GL_READ_FRAMEBUFFER_BINDING+ GetFramebufferBinding -> Just GL_FRAMEBUFFER_BINDING -- renderbufferbinding- GetRenderbufferBinding -> Just gl_RENDERBUFFER_BINDING+ GetRenderbufferBinding -> Just GL_RENDERBUFFER_BINDING -- hint- GetPerspectiveCorrectionHint -> Just gl_PERSPECTIVE_CORRECTION_HINT- GetPointSmoothHint -> Just gl_POINT_SMOOTH_HINT- GetLineSmoothHint -> Just gl_LINE_SMOOTH_HINT- GetPolygonSmoothHint -> Just gl_POLYGON_SMOOTH_HINT- GetFogHint -> Just gl_FOG_HINT- GetGenerateMipmapHint -> Just gl_GENERATE_MIPMAP_HINT- GetTextureCompressionHint -> Just gl_TEXTURE_COMPRESSION_HINT- GetPackCMYKHint -> Just gl_PACK_CMYK_HINT_EXT- GetUnpackCMYKHint -> Just gl_UNPACK_CMYK_HINT_EXT- GetVertexArrayBinding -> Just gl_VERTEX_ARRAY_BINDING+ GetPerspectiveCorrectionHint -> Just GL_PERSPECTIVE_CORRECTION_HINT+ GetPointSmoothHint -> Just GL_POINT_SMOOTH_HINT+ GetLineSmoothHint -> Just GL_LINE_SMOOTH_HINT+ GetPolygonSmoothHint -> Just GL_POLYGON_SMOOTH_HINT+ GetFogHint -> Just GL_FOG_HINT+ GetGenerateMipmapHint -> Just GL_GENERATE_MIPMAP_HINT+ GetTextureCompressionHint -> Just GL_TEXTURE_COMPRESSION_HINT+ GetPackCMYKHint -> Just GL_PACK_CMYK_HINT_EXT+ GetUnpackCMYKHint -> Just GL_UNPACK_CMYK_HINT_EXT+ GetVertexArrayBinding -> Just GL_VERTEX_ARRAY_BINDING -- Selection ?- GetMaxNameStackDepth -> Just gl_MAX_NAME_STACK_DEPTH- GetNameStackDepth -> Just gl_NAME_STACK_DEPTH+ GetMaxNameStackDepth -> Just GL_MAX_NAME_STACK_DEPTH+ GetNameStackDepth -> Just GL_NAME_STACK_DEPTH -- ContextProfile- GetContextProfileMask -> Just gl_CONTEXT_PROFILE_MASK+ GetContextProfileMask -> Just GL_CONTEXT_PROFILE_MASK --pixel storage- GetPackSwapBytes -> Just gl_PACK_SWAP_BYTES- GetUnpackSwapBytes -> Just gl_UNPACK_SWAP_BYTES- GetPackLSBFirst -> Just gl_PACK_LSB_FIRST- GetUnpackLSBFirst -> Just gl_UNPACK_LSB_FIRST- GetPackRowLength -> Just gl_PACK_ROW_LENGTH- GetUnpackRowLength -> Just gl_UNPACK_ROW_LENGTH- GetPackSkipRows -> Just gl_PACK_SKIP_ROWS- GetUnpackSkipRows -> Just gl_UNPACK_SKIP_ROWS- GetPackSkipPixels -> Just gl_PACK_SKIP_PIXELS- GetUnpackSkipPixels -> Just gl_UNPACK_SKIP_PIXELS- GetPackAlignment -> Just gl_PACK_ALIGNMENT- GetUnpackAlignment -> Just gl_UNPACK_ALIGNMENT- GetPackSkipImages -> Just gl_PACK_SKIP_IMAGES- GetUnpackSkipImages -> Just gl_UNPACK_SKIP_IMAGES- GetPackImageHeight -> Just gl_PACK_IMAGE_HEIGHT- GetUnpackImageHeight -> Just gl_UNPACK_IMAGE_HEIGHT+ GetPackSwapBytes -> Just GL_PACK_SWAP_BYTES+ GetUnpackSwapBytes -> Just GL_UNPACK_SWAP_BYTES+ GetPackLSBFirst -> Just GL_PACK_LSB_FIRST+ GetUnpackLSBFirst -> Just GL_UNPACK_LSB_FIRST+ GetPackRowLength -> Just GL_PACK_ROW_LENGTH+ GetUnpackRowLength -> Just GL_UNPACK_ROW_LENGTH+ GetPackSkipRows -> Just GL_PACK_SKIP_ROWS+ GetUnpackSkipRows -> Just GL_UNPACK_SKIP_ROWS+ GetPackSkipPixels -> Just GL_PACK_SKIP_PIXELS+ GetUnpackSkipPixels -> Just GL_UNPACK_SKIP_PIXELS+ GetPackAlignment -> Just GL_PACK_ALIGNMENT+ GetUnpackAlignment -> Just GL_UNPACK_ALIGNMENT+ GetPackSkipImages -> Just GL_PACK_SKIP_IMAGES+ GetUnpackSkipImages -> Just GL_UNPACK_SKIP_IMAGES+ GetPackImageHeight -> Just GL_PACK_IMAGE_HEIGHT+ GetUnpackImageHeight -> Just GL_UNPACK_IMAGE_HEIGHT -- pixelmap- GetPixelMapIToISize -> Just gl_PIXEL_MAP_I_TO_I_SIZE- GetPixelMapSToSSize -> Just gl_PIXEL_MAP_S_TO_S_SIZE- GetPixelMapIToRSize -> Just gl_PIXEL_MAP_I_TO_R_SIZE- GetPixelMapIToGSize -> Just gl_PIXEL_MAP_I_TO_G_SIZE- GetPixelMapIToBSize -> Just gl_PIXEL_MAP_I_TO_B_SIZE- GetPixelMapIToASize -> Just gl_PIXEL_MAP_I_TO_A_SIZE- GetPixelMapRToRSize -> Just gl_PIXEL_MAP_R_TO_R_SIZE- GetPixelMapGToGSize -> Just gl_PIXEL_MAP_G_TO_G_SIZE- GetPixelMapBToBSize -> Just gl_PIXEL_MAP_B_TO_B_SIZE- GetPixelMapAToASize -> Just gl_PIXEL_MAP_A_TO_A_SIZE- GetMaxPixelMapTable -> Just gl_MAX_PIXEL_MAP_TABLE+ GetPixelMapIToISize -> Just GL_PIXEL_MAP_I_TO_I_SIZE+ GetPixelMapSToSSize -> Just GL_PIXEL_MAP_S_TO_S_SIZE+ GetPixelMapIToRSize -> Just GL_PIXEL_MAP_I_TO_R_SIZE+ GetPixelMapIToGSize -> Just GL_PIXEL_MAP_I_TO_G_SIZE+ GetPixelMapIToBSize -> Just GL_PIXEL_MAP_I_TO_B_SIZE+ GetPixelMapIToASize -> Just GL_PIXEL_MAP_I_TO_A_SIZE+ GetPixelMapRToRSize -> Just GL_PIXEL_MAP_R_TO_R_SIZE+ GetPixelMapGToGSize -> Just GL_PIXEL_MAP_G_TO_G_SIZE+ GetPixelMapBToBSize -> Just GL_PIXEL_MAP_B_TO_B_SIZE+ GetPixelMapAToASize -> Just GL_PIXEL_MAP_A_TO_A_SIZE+ GetMaxPixelMapTable -> Just GL_MAX_PIXEL_MAP_TABLE -- shader limits- GetMaxVertexTextureImageUnits -> Just gl_MAX_VERTEX_TEXTURE_IMAGE_UNITS- GetMaxTextureImageUnits -> Just gl_MAX_TEXTURE_IMAGE_UNITS- GetMaxCombinedTextureImageUnits -> Just gl_MAX_COMBINED_TEXTURE_IMAGE_UNITS- GetMaxTextureCoords -> Just gl_MAX_TEXTURE_COORDS- GetMaxVertexUniformComponents -> Just gl_MAX_VERTEX_UNIFORM_COMPONENTS- GetMaxFragmentUniformComponents -> Just gl_MAX_FRAGMENT_UNIFORM_COMPONENTS- GetMaxVaryingFloats -> Just gl_MAX_VARYING_COMPONENTS- GetMaxVertexAttribs -> Just gl_MAX_VERTEX_ATTRIBS+ GetMaxVertexTextureImageUnits -> Just GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS+ GetMaxTextureImageUnits -> Just GL_MAX_TEXTURE_IMAGE_UNITS+ GetMaxCombinedTextureImageUnits -> Just GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS+ GetMaxTextureCoords -> Just GL_MAX_TEXTURE_COORDS+ GetMaxVertexUniformComponents -> Just GL_MAX_VERTEX_UNIFORM_COMPONENTS+ GetMaxFragmentUniformComponents -> Just GL_MAX_FRAGMENT_UNIFORM_COMPONENTS+ GetMaxVaryingFloats -> Just GL_MAX_VARYING_COMPONENTS+ GetMaxVertexAttribs -> Just GL_MAX_VERTEX_ATTRIBS -- tessellation- GetMaxPatchVertices -> Just gl_MAX_PATCH_VERTICES- GetMaxTessellationLevel -> Just gl_MAX_TESS_GEN_LEVEL+ GetPatchVertices -> Just GL_PATCH_VERTICES+ GetMaxPatchVertices -> Just GL_MAX_PATCH_VERTICES+ GetMaxTessGenLevel -> Just GL_MAX_TESS_GEN_LEVEL -- coordtrans- GetMatrixMode -> Just gl_MATRIX_MODE- GetModelviewStackDepth -> Just gl_MODELVIEW_STACK_DEPTH- GetProjectionStackDepth -> Just gl_PROJECTION_STACK_DEPTH- GetTextureStackDepth -> Just gl_TEXTURE_STACK_DEPTH- GetColorMatrixStackDepth -> Just gl_COLOR_MATRIX_STACK_DEPTH- GetMaxModelviewStackDepth -> Just gl_MAX_MODELVIEW_STACK_DEPTH- GetMaxProjectionStackDepth -> Just gl_MAX_PROJECTION_STACK_DEPTH- GetMaxTextureStackDepth -> Just gl_MAX_TEXTURE_STACK_DEPTH- GetMaxColorMatrixStackDepth -> Just gl_MAX_COLOR_MATRIX_STACK_DEPTH- GetMaxMatrixPaletteStackDepth -> Just gl_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB- GetCurrentMatrixStackDepth -> Just gl_CURRENT_MATRIX_STACK_DEPTH_ARB- GetActiveTexture -> Just gl_ACTIVE_TEXTURE+ GetMatrixMode -> Just GL_MATRIX_MODE+ GetModelviewStackDepth -> Just GL_MODELVIEW_STACK_DEPTH+ GetProjectionStackDepth -> Just GL_PROJECTION_STACK_DEPTH+ GetTextureStackDepth -> Just GL_TEXTURE_STACK_DEPTH+ GetColorMatrixStackDepth -> Just GL_COLOR_MATRIX_STACK_DEPTH+ GetMaxModelviewStackDepth -> Just GL_MAX_MODELVIEW_STACK_DEPTH+ GetMaxProjectionStackDepth -> Just GL_MAX_PROJECTION_STACK_DEPTH+ GetMaxTextureStackDepth -> Just GL_MAX_TEXTURE_STACK_DEPTH+ GetMaxColorMatrixStackDepth -> Just GL_MAX_COLOR_MATRIX_STACK_DEPTH+ GetMaxMatrixPaletteStackDepth -> Just GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB+ GetCurrentMatrixStackDepth -> Just GL_CURRENT_MATRIX_STACK_DEPTH_ARB+ GetActiveTexture -> Just GL_ACTIVE_TEXTURE -- vertexarrays- GetVertexArraySize -> Just gl_VERTEX_ARRAY_SIZE- GetVertexArrayType -> Just gl_VERTEX_ARRAY_TYPE- GetVertexArrayStride -> Just gl_VERTEX_ARRAY_STRIDE- GetNormalArrayType -> Just gl_NORMAL_ARRAY_TYPE- GetNormalArrayStride -> Just gl_NORMAL_ARRAY_STRIDE- GetColorArraySize -> Just gl_COLOR_ARRAY_SIZE- GetColorArrayType -> Just gl_COLOR_ARRAY_TYPE- GetColorArrayStride -> Just gl_COLOR_ARRAY_STRIDE- GetIndexArrayType -> Just gl_INDEX_ARRAY_TYPE- GetIndexArrayStride -> Just gl_INDEX_ARRAY_STRIDE- GetTextureCoordArraySize -> Just gl_TEXTURE_COORD_ARRAY_SIZE- GetTextureCoordArrayType -> Just gl_TEXTURE_COORD_ARRAY_TYPE- GetTextureCoordArrayStride -> Just gl_TEXTURE_COORD_ARRAY_STRIDE- GetEdgeFlagArrayStride -> Just gl_EDGE_FLAG_ARRAY_STRIDE- GetFogCoordArrayType -> Just gl_FOG_COORD_ARRAY_TYPE- GetFogCoordArrayStride -> Just gl_FOG_COORD_ARRAY_STRIDE- GetSecondaryColorArraySize -> Just gl_SECONDARY_COLOR_ARRAY_SIZE- GetSecondaryColorArrayType -> Just gl_SECONDARY_COLOR_ARRAY_TYPE- GetSecondaryColorArrayStride -> Just gl_SECONDARY_COLOR_ARRAY_STRIDE- GetArrayElementLockCount -> Just gl_ARRAY_ELEMENT_LOCK_COUNT_EXT- GetArrayElementLockFirst -> Just gl_ARRAY_ELEMENT_LOCK_FIRST_EXT- GetClientActiveTexture -> Just gl_CLIENT_ACTIVE_TEXTURE- GetMaxElementsVertices -> Just gl_MAX_ELEMENTS_VERTICES- GetMaxElementsIndices -> Just gl_MAX_ELEMENTS_INDICES- GetPrimitiveRestartIndex -> Just gl_PRIMITIVE_RESTART_INDEX- GetPrimitiveRestartNV -> Just gl_PRIMITIVE_RESTART_NV- GetPrimitiveRestartIndexNV -> Just gl_PRIMITIVE_RESTART_INDEX_NV+ GetVertexArraySize -> Just GL_VERTEX_ARRAY_SIZE+ GetVertexArrayType -> Just GL_VERTEX_ARRAY_TYPE+ GetVertexArrayStride -> Just GL_VERTEX_ARRAY_STRIDE+ GetNormalArrayType -> Just GL_NORMAL_ARRAY_TYPE+ GetNormalArrayStride -> Just GL_NORMAL_ARRAY_STRIDE+ GetColorArraySize -> Just GL_COLOR_ARRAY_SIZE+ GetColorArrayType -> Just GL_COLOR_ARRAY_TYPE+ GetColorArrayStride -> Just GL_COLOR_ARRAY_STRIDE+ GetIndexArrayType -> Just GL_INDEX_ARRAY_TYPE+ GetIndexArrayStride -> Just GL_INDEX_ARRAY_STRIDE+ GetTextureCoordArraySize -> Just GL_TEXTURE_COORD_ARRAY_SIZE+ GetTextureCoordArrayType -> Just GL_TEXTURE_COORD_ARRAY_TYPE+ GetTextureCoordArrayStride -> Just GL_TEXTURE_COORD_ARRAY_STRIDE+ GetEdgeFlagArrayStride -> Just GL_EDGE_FLAG_ARRAY_STRIDE+ GetFogCoordArrayType -> Just GL_FOG_COORD_ARRAY_TYPE+ GetFogCoordArrayStride -> Just GL_FOG_COORD_ARRAY_STRIDE+ GetSecondaryColorArraySize -> Just GL_SECONDARY_COLOR_ARRAY_SIZE+ GetSecondaryColorArrayType -> Just GL_SECONDARY_COLOR_ARRAY_TYPE+ GetSecondaryColorArrayStride -> Just GL_SECONDARY_COLOR_ARRAY_STRIDE+ GetArrayElementLockCount -> Just GL_ARRAY_ELEMENT_LOCK_COUNT_EXT+ GetArrayElementLockFirst -> Just GL_ARRAY_ELEMENT_LOCK_FIRST_EXT+ GetClientActiveTexture -> Just GL_CLIENT_ACTIVE_TEXTURE+ GetMaxElementsVertices -> Just GL_MAX_ELEMENTS_VERTICES+ GetMaxElementsIndices -> Just GL_MAX_ELEMENTS_INDICES+ GetPrimitiveRestartIndex -> Just GL_PRIMITIVE_RESTART_INDEX+ GetPrimitiveRestartNV -> Just GL_PRIMITIVE_RESTART_NV+ GetPrimitiveRestartIndexNV -> Just GL_PRIMITIVE_RESTART_INDEX_NV -- bufferobjects- GetArrayBufferBinding -> Just gl_ARRAY_BUFFER_BINDING- GetAtomicCounterBufferBinding -> Just gl_ATOMIC_COUNTER_BUFFER_BINDING- GetCopyReadBufferBinding -> Just gl_COPY_READ_BUFFER_BINDING- GetCopyWriteBufferBinding -> Just gl_COPY_WRITE_BUFFER_BINDING- GetDispatchIndirectBufferBinding -> Just gl_DISPATCH_INDIRECT_BUFFER_BINDING- GetDrawIndirectBufferBinding -> Just gl_DRAW_INDIRECT_BUFFER_BINDING- GetElementArrayBufferBinding -> Just gl_ELEMENT_ARRAY_BUFFER_BINDING- GetPixelPackBufferBinding -> Just gl_PIXEL_PACK_BUFFER_BINDING- GetPixelUnpackBufferBinding -> Just gl_PIXEL_UNPACK_BUFFER_BINDING- GetQueryBufferBinding -> Just gl_QUERY_BUFFER_BINDING- GetShaderStorageBufferBinding -> Just gl_SHADER_STORAGE_BUFFER_BINDING- GetTransformFeedbackBufferBinding -> Just gl_TRANSFORM_FEEDBACK_BUFFER_BINDING- GetUniformBufferBinding -> Just gl_UNIFORM_BUFFER_BINDING+ GetArrayBufferBinding -> Just GL_ARRAY_BUFFER_BINDING+ GetAtomicCounterBufferBinding -> Just GL_ATOMIC_COUNTER_BUFFER_BINDING+ GetCopyReadBufferBinding -> Just GL_COPY_READ_BUFFER_BINDING+ GetCopyWriteBufferBinding -> Just GL_COPY_WRITE_BUFFER_BINDING+ GetDispatchIndirectBufferBinding -> Just GL_DISPATCH_INDIRECT_BUFFER_BINDING+ GetDrawIndirectBufferBinding -> Just GL_DRAW_INDIRECT_BUFFER_BINDING+ GetElementArrayBufferBinding -> Just GL_ELEMENT_ARRAY_BUFFER_BINDING+ GetPixelPackBufferBinding -> Just GL_PIXEL_PACK_BUFFER_BINDING+ GetPixelUnpackBufferBinding -> Just GL_PIXEL_UNPACK_BUFFER_BINDING+ GetQueryBufferBinding -> Just GL_QUERY_BUFFER_BINDING+ GetShaderStorageBufferBinding -> Just GL_SHADER_STORAGE_BUFFER_BINDING+ GetTransformFeedbackBufferBinding -> Just GL_TRANSFORM_FEEDBACK_BUFFER_BINDING+ GetUniformBufferBinding -> Just GL_UNIFORM_BUFFER_BINDING - GetVertexArrayBufferBinding -> Just gl_VERTEX_ARRAY_BUFFER_BINDING- GetNormalArrayBufferBinding -> Just gl_NORMAL_ARRAY_BUFFER_BINDING- GetColorArrayBufferBinding -> Just gl_COLOR_ARRAY_BUFFER_BINDING- GetIndexArrayBufferBinding -> Just gl_INDEX_ARRAY_BUFFER_BINDING- GetTextureCoordArrayBufferBinding -> Just gl_TEXTURE_COORD_ARRAY_BUFFER_BINDING- GetEdgeFlagArrayBufferBinding -> Just gl_EDGE_FLAG_ARRAY_BUFFER_BINDING- GetSecondaryColorArrayBufferBinding -> Just gl_SECONDARY_COLOR_ARRAY_BUFFER_BINDING- GetFogCoordArrayBufferBinding -> Just gl_FOG_COORD_ARRAY_BUFFER_BINDING+ GetVertexArrayBufferBinding -> Just GL_VERTEX_ARRAY_BUFFER_BINDING+ GetNormalArrayBufferBinding -> Just GL_NORMAL_ARRAY_BUFFER_BINDING+ GetColorArrayBufferBinding -> Just GL_COLOR_ARRAY_BUFFER_BINDING+ GetIndexArrayBufferBinding -> Just GL_INDEX_ARRAY_BUFFER_BINDING+ GetTextureCoordArrayBufferBinding -> Just GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING+ GetEdgeFlagArrayBufferBinding -> Just GL_EDGE_FLAG_ARRAY_BUFFER_BINDING+ GetSecondaryColorArrayBufferBinding -> Just GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING+ GetFogCoordArrayBufferBinding -> Just GL_FOG_COORD_ARRAY_BUFFER_BINDING -- clipping- GetMaxClipPlanes -> Just gl_MAX_CLIP_DISTANCES+ GetMaxClipPlanes -> Just GL_MAX_CLIP_DISTANCES -- Colors- GetMaxLights -> Just gl_MAX_LIGHTS- GetFrontFace -> Just gl_FRONT_FACE- GetLightModelLocalViewer -> Just gl_LIGHT_MODEL_LOCAL_VIEWER- GetLightModelTwoSide -> Just gl_LIGHT_MODEL_TWO_SIDE- GetLightModelColorControl -> Just gl_LIGHT_MODEL_COLOR_CONTROL- GetColorMaterialFace -> Just gl_COLOR_MATERIAL_FACE- GetColorMaterialParameter -> Just gl_COLOR_MATERIAL_PARAMETER- GetShadeModel -> Just gl_SHADE_MODEL- GetVertexColorClamp -> Just gl_CLAMP_VERTEX_COLOR- GetFragmentColorClamp -> Just gl_CLAMP_FRAGMENT_COLOR- GetReadColorClamp -> Just gl_CLAMP_READ_COLOR+ GetMaxLights -> Just GL_MAX_LIGHTS+ GetFrontFace -> Just GL_FRONT_FACE+ GetLightModelLocalViewer -> Just GL_LIGHT_MODEL_LOCAL_VIEWER+ GetLightModelTwoSide -> Just GL_LIGHT_MODEL_TWO_SIDE+ GetLightModelColorControl -> Just GL_LIGHT_MODEL_COLOR_CONTROL+ GetColorMaterialFace -> Just GL_COLOR_MATERIAL_FACE+ GetColorMaterialParameter -> Just GL_COLOR_MATERIAL_PARAMETER+ GetShadeModel -> Just GL_SHADE_MODEL+ GetVertexColorClamp -> Just GL_CLAMP_VERTEX_COLOR+ GetFragmentColorClamp -> Just GL_CLAMP_FRAGMENT_COLOR+ GetReadColorClamp -> Just GL_CLAMP_READ_COLOR -- Evaluators- GetMaxEvalOrder -> Just gl_MAX_EVAL_ORDER- GetMap1GridSegments -> Just gl_MAP1_GRID_SEGMENTS+ GetMaxEvalOrder -> Just GL_MAX_EVAL_ORDER+ GetMap1GridSegments -> Just GL_MAP1_GRID_SEGMENTS -- Fog- GetFogMode -> Just gl_FOG_MODE- GetFogIndex -> Just gl_FOG_INDEX- GetFogCoordSrc -> Just gl_FOG_COORD_SRC- GetFogDistanceMode -> Just gl_FOG_DISTANCE_MODE_NV+ GetFogMode -> Just GL_FOG_MODE+ GetFogIndex -> Just GL_FOG_INDEX+ GetFogCoordSrc -> Just GL_FOG_COORD_SRC+ GetFogDistanceMode -> Just GL_FOG_DISTANCE_MODE_NV -- Framebuffer- GetAuxBuffers -> Just gl_AUX_BUFFERS- GetDoublebuffer -> Just gl_DOUBLEBUFFER- GetStereo -> Just gl_STEREO- GetRedBits -> Just gl_RED_BITS- GetGreenBits -> Just gl_GREEN_BITS- GetBlueBits -> Just gl_BLUE_BITS- GetAlphaBits -> Just gl_ALPHA_BITS- GetDepthBits -> Just gl_DEPTH_BITS- GetStencilBits -> Just gl_STENCIL_BITS- GetAccumRedBits -> Just gl_ACCUM_RED_BITS- GetAccumGreenBits -> Just gl_ACCUM_GREEN_BITS- GetAccumBlueBits -> Just gl_ACCUM_BLUE_BITS- GetAccumAlphaBits -> Just gl_ACCUM_ALPHA_BITS- GetDrawBuffer -> Just gl_DRAW_BUFFER+ GetAuxBuffers -> Just GL_AUX_BUFFERS+ GetDoublebuffer -> Just GL_DOUBLEBUFFER+ GetStereo -> Just GL_STEREO+ GetRedBits -> Just GL_RED_BITS+ GetGreenBits -> Just GL_GREEN_BITS+ GetBlueBits -> Just GL_BLUE_BITS+ GetAlphaBits -> Just GL_ALPHA_BITS+ GetDepthBits -> Just GL_DEPTH_BITS+ GetStencilBits -> Just GL_STENCIL_BITS+ GetAccumRedBits -> Just GL_ACCUM_RED_BITS+ GetAccumGreenBits -> Just GL_ACCUM_GREEN_BITS+ GetAccumBlueBits -> Just GL_ACCUM_BLUE_BITS+ GetAccumAlphaBits -> Just GL_ACCUM_ALPHA_BITS+ GetDrawBuffer -> Just GL_DRAW_BUFFER GetDrawBufferN i -> drawBufferIndexToEnum i- GetMaxDrawBuffers -> Just gl_MAX_DRAW_BUFFERS- GetIndexWritemask -> Just gl_INDEX_WRITEMASK- GetDepthWritemask -> Just gl_DEPTH_WRITEMASK- GetStencilWritemask -> Just gl_STENCIL_WRITEMASK- GetStencilClearValue -> Just gl_STENCIL_CLEAR_VALUE+ GetMaxDrawBuffers -> Just GL_MAX_DRAW_BUFFERS+ GetIndexWritemask -> Just GL_INDEX_WRITEMASK+ GetDepthWritemask -> Just GL_DEPTH_WRITEMASK+ GetStencilWritemask -> Just GL_STENCIL_WRITEMASK+ GetStencilBackWritemask -> Just GL_STENCIL_BACK_WRITEMASK+ GetStencilClearValue -> Just GL_STENCIL_CLEAR_VALUE -- Program- GetCurrentProgram -> Just gl_CURRENT_PROGRAM+ GetCurrentProgram -> Just GL_CURRENT_PROGRAM -- Transformfeedback- GetMaxTransformFeedbackSeparateAttribs -> Just gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS- GetMaxTransformFeedbackSeparateComponents -> Just gl_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS- GetMaxTransformFeedbackInterleavedComponents -> Just gl_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS+ GetMaxTransformFeedbackSeparateAttribs -> Just GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS+ GetMaxTransformFeedbackSeparateComponents -> Just GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS+ GetMaxTransformFeedbackInterleavedComponents -> Just GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS -- RasterPos- GetCurrentRasterIndex -> Just gl_CURRENT_RASTER_INDEX- GetCurrentRasterPositionValid -> Just gl_CURRENT_RASTER_POSITION_VALID+ GetCurrentRasterIndex -> Just GL_CURRENT_RASTER_INDEX+ GetCurrentRasterPositionValid -> Just GL_CURRENT_RASTER_POSITION_VALID -- LineSegment- GetLineStipplePattern -> Just gl_LINE_STIPPLE_PATTERN- GetLineStippleRepeat -> Just gl_LINE_STIPPLE_REPEAT+ GetLineStipplePattern -> Just GL_LINE_STIPPLE_PATTERN+ GetLineStippleRepeat -> Just GL_LINE_STIPPLE_REPEAT -- PerFragment- GetSampleCoverageInvert -> Just gl_SAMPLE_COVERAGE_INVERT- GetAlphaTestFunc -> Just gl_ALPHA_TEST_FUNC- GetStencilFunc -> Just gl_STENCIL_FUNC- GetStencilValueMask -> Just gl_STENCIL_VALUE_MASK- GetStencilRef -> Just gl_STENCIL_REF- GetStencilFail -> Just gl_STENCIL_FAIL- GetStencilPassDepthFail -> Just gl_STENCIL_PASS_DEPTH_FAIL- GetStencilPassDepthPass -> Just gl_STENCIL_PASS_DEPTH_PASS- GetActiveStencilFace -> Just gl_ACTIVE_STENCIL_FACE_EXT- GetLogicOpMode -> Just gl_LOGIC_OP_MODE- GetBlendDst -> Just gl_BLEND_DST- GetBlendSrc -> Just gl_BLEND_SRC- GetBlendDstRGB -> Just gl_BLEND_DST_RGB- GetBlendSrcRGB -> Just gl_BLEND_SRC_RGB- GetBlendDstAlpha -> Just gl_BLEND_DST_ALPHA- GetBlendSrcAlpha -> Just gl_BLEND_SRC_ALPHA- GetBlendEquation -> Just gl_BLEND_EQUATION_RGB- GetBlendEquationAlpha -> Just gl_BLEND_EQUATION_ALPHA- GetDepthFunc -> Just gl_DEPTH_FUNC- GetMapColor -> Just gl_MAP_COLOR- GetMapStencil -> Just gl_MAP_STENCIL- GetIndexShift -> Just gl_INDEX_SHIFT- GetIndexOffset -> Just gl_INDEX_OFFSET+ GetSampleCoverageInvert -> Just GL_SAMPLE_COVERAGE_INVERT+ GetAlphaTestFunc -> Just GL_ALPHA_TEST_FUNC+ GetStencilFunc -> Just GL_STENCIL_FUNC+ GetStencilBackFunc -> Just GL_STENCIL_BACK_FUNC+ GetStencilValueMask -> Just GL_STENCIL_VALUE_MASK+ GetStencilBackValueMask -> Just GL_STENCIL_BACK_VALUE_MASK+ GetStencilRef -> Just GL_STENCIL_REF+ GetStencilBackRef -> Just GL_STENCIL_BACK_REF+ GetStencilFail -> Just GL_STENCIL_FAIL+ GetStencilBackFail -> Just GL_STENCIL_BACK_FAIL+ GetStencilPassDepthFail -> Just GL_STENCIL_PASS_DEPTH_FAIL+ GetStencilBackPassDepthFail -> Just GL_STENCIL_BACK_PASS_DEPTH_FAIL+ GetStencilPassDepthPass -> Just GL_STENCIL_PASS_DEPTH_PASS+ GetStencilBackPassDepthPass -> Just GL_STENCIL_BACK_PASS_DEPTH_PASS+ GetActiveStencilFace -> Just GL_ACTIVE_STENCIL_FACE_EXT+ GetLogicOpMode -> Just GL_LOGIC_OP_MODE+ GetBlendDst -> Just GL_BLEND_DST+ GetBlendSrc -> Just GL_BLEND_SRC+ GetBlendDstRGB -> Just GL_BLEND_DST_RGB+ GetBlendSrcRGB -> Just GL_BLEND_SRC_RGB+ GetBlendDstAlpha -> Just GL_BLEND_DST_ALPHA+ GetBlendSrcAlpha -> Just GL_BLEND_SRC_ALPHA+ GetBlendEquation -> Just GL_BLEND_EQUATION_RGB+ GetBlendEquationAlpha -> Just GL_BLEND_EQUATION_ALPHA+ GetDepthFunc -> Just GL_DEPTH_FUNC+ GetMapColor -> Just GL_MAP_COLOR+ GetMapStencil -> Just GL_MAP_STENCIL+ GetIndexShift -> Just GL_INDEX_SHIFT+ GetIndexOffset -> Just GL_INDEX_OFFSET -- Polygons- GetCullFaceMode -> Just gl_CULL_FACE_MODE+ GetCullFaceMode -> Just GL_CULL_FACE_MODE -- Texture specification- GetNumCompressedTextureFormats -> Just gl_NUM_COMPRESSED_TEXTURE_FORMATS- GetMaxTextureSize -> Just gl_MAX_TEXTURE_SIZE- GetMax3DTextureSize -> Just gl_MAX_3D_TEXTURE_SIZE- GetMaxCubeMapTextureSize -> Just gl_MAX_CUBE_MAP_TEXTURE_SIZE- GetMaxRectangleTextureSize -> Just gl_MAX_RECTANGLE_TEXTURE_SIZE- GetMaxArrayTextureLayers -> Just gl_MAX_ARRAY_TEXTURE_LAYERS- GetMaxSampleMaskWords -> Just gl_MAX_SAMPLE_MASK_WORDS- GetMaxColorTextureSamples -> Just gl_MAX_COLOR_TEXTURE_SAMPLES- GetMaxDepthTextureSamples -> Just gl_MAX_DEPTH_TEXTURE_SAMPLES- GetMaxIntegerSamples -> Just gl_MAX_INTEGER_SAMPLES+ GetNumCompressedTextureFormats -> Just GL_NUM_COMPRESSED_TEXTURE_FORMATS+ GetMaxTextureSize -> Just GL_MAX_TEXTURE_SIZE+ GetMax3DTextureSize -> Just GL_MAX_3D_TEXTURE_SIZE+ GetMaxCubeMapTextureSize -> Just GL_MAX_CUBE_MAP_TEXTURE_SIZE+ GetMaxRectangleTextureSize -> Just GL_MAX_RECTANGLE_TEXTURE_SIZE+ GetMaxArrayTextureLayers -> Just GL_MAX_ARRAY_TEXTURE_LAYERS+ GetMaxSampleMaskWords -> Just GL_MAX_SAMPLE_MASK_WORDS+ GetMaxColorTextureSamples -> Just GL_MAX_COLOR_TEXTURE_SAMPLES+ GetMaxDepthTextureSamples -> Just GL_MAX_DEPTH_TEXTURE_SAMPLES+ GetMaxIntegerSamples -> Just GL_MAX_INTEGER_SAMPLES -- ReadCopyPixels- GetReadBuffer -> Just gl_READ_BUFFER+ GetReadBuffer -> Just GL_READ_BUFFER -- Texture Objects- GetTextureBinding1D -> Just gl_TEXTURE_BINDING_1D- GetTextureBinding2D -> Just gl_TEXTURE_BINDING_2D- GetTextureBinding3D -> Just gl_TEXTURE_BINDING_3D- GetTextureBinding1DArray -> Just gl_TEXTURE_BINDING_1D_ARRAY- GetTextureBinding2DArray -> Just gl_TEXTURE_BINDING_2D_ARRAY- GetTextureBindingCubeMapArray -> Just gl_TEXTURE_BINDING_CUBE_MAP_ARRAY- GetTextureBindingRectangle -> Just gl_TEXTURE_BINDING_RECTANGLE- GetTextureBindingBuffer -> Just gl_TEXTURE_BINDING_BUFFER- GetTextureBindingCubeMap -> Just gl_TEXTURE_BINDING_CUBE_MAP- GetTextureBinding2DMultisample -> Just gl_TEXTURE_BINDING_2D_MULTISAMPLE- GetTextureBinding2DMultisampleArray -> Just gl_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY+ GetTextureBinding1D -> Just GL_TEXTURE_BINDING_1D+ GetTextureBinding2D -> Just GL_TEXTURE_BINDING_2D+ GetTextureBinding3D -> Just GL_TEXTURE_BINDING_3D+ GetTextureBinding1DArray -> Just GL_TEXTURE_BINDING_1D_ARRAY+ GetTextureBinding2DArray -> Just GL_TEXTURE_BINDING_2D_ARRAY+ GetTextureBindingCubeMapArray -> Just GL_TEXTURE_BINDING_CUBE_MAP_ARRAY+ GetTextureBindingRectangle -> Just GL_TEXTURE_BINDING_RECTANGLE+ GetTextureBindingBuffer -> Just GL_TEXTURE_BINDING_BUFFER+ GetTextureBindingCubeMap -> Just GL_TEXTURE_BINDING_CUBE_MAP+ GetTextureBinding2DMultisample -> Just GL_TEXTURE_BINDING_2D_MULTISAMPLE+ GetTextureBinding2DMultisampleArray -> Just GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY -- Antialiasing- GetSubpixelBits -> Just gl_SUBPIXEL_BITS- GetSampleBuffers -> Just gl_SAMPLE_BUFFERS- GetSamples -> Just gl_SAMPLES+ GetSubpixelBits -> Just GL_SUBPIXEL_BITS+ GetSampleBuffers -> Just GL_SAMPLE_BUFFERS+ GetSamples -> Just GL_SAMPLES -- Sync Objects- GetMaxServerWaitTimeout -> Just gl_MAX_SERVER_WAIT_TIMEOUT+ GetMaxServerWaitTimeout -> Just GL_MAX_SERVER_WAIT_TIMEOUT -- Query Objects- GetMaxVertexStreams -> Just gl_MAX_VERTEX_STREAMS+ GetMaxVertexStreams -> Just GL_MAX_VERTEX_STREAMS -- GL Time- GetTimestamp -> Just gl_TIMESTAMP+ GetTimestamp -> Just GL_TIMESTAMP -- Shader- GetShaderCompiler -> Just gl_SHADER_COMPILER- GetNumShaderBinaryFormats -> Just gl_NUM_SHADER_BINARY_FORMATS- GetNumProgramBinaryFormats -> Just gl_NUM_PROGRAM_BINARY_FORMATS+ GetShaderCompiler -> Just GL_SHADER_COMPILER+ GetNumShaderBinaryFormats -> Just GL_NUM_SHADER_BINARY_FORMATS+ GetNumProgramBinaryFormats -> Just GL_NUM_PROGRAM_BINARY_FORMATS -- Debug Output- GetMaxDebugMessageLength -> Just gl_MAX_DEBUG_MESSAGE_LENGTH- GetMaxDebugLoggedMessages -> Just gl_MAX_DEBUG_LOGGED_MESSAGES- GetDebugLoggedMessages -> Just gl_DEBUG_LOGGED_MESSAGES- GetDebugNextLoggedMessageLength -> Just gl_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH- GetMaxDebugGroupStackDepth -> Just gl_MAX_DEBUG_GROUP_STACK_DEPTH+ GetMaxDebugMessageLength -> Just GL_MAX_DEBUG_MESSAGE_LENGTH+ GetMaxDebugLoggedMessages -> Just GL_MAX_DEBUG_LOGGED_MESSAGES+ GetDebugLoggedMessages -> Just GL_DEBUG_LOGGED_MESSAGES+ GetDebugNextLoggedMessageLength -> Just GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH+ GetMaxDebugGroupStackDepth -> Just GL_MAX_DEBUG_GROUP_STACK_DEPTH+ GetMaxLabelLength -> Just GL_MAX_LABEL_LENGTH+ GetNumExtensions -> Just GL_NUM_EXTENSIONS -- 0x8825 through 0x8834 are reserved for draw buffers drawBufferIndexToEnum :: GLsizei -> Maybe GLenum drawBufferIndexToEnum i- | 0 <= i && i <= maxDrawBufferIndex = Just (gl_DRAW_BUFFER0 + fromIntegral i)+ | 0 <= i && i <= maxDrawBufferIndex = Just (GL_DRAW_BUFFER0 + fromIntegral i) | otherwise = Nothing maxDrawBufferIndex :: GLsizei-maxDrawBufferIndex = fromIntegral (gl_DRAW_BUFFER15 - gl_DRAW_BUFFER0)+maxDrawBufferIndex = fromIntegral (GL_DRAW_BUFFER15 - GL_DRAW_BUFFER0) -----------------------------------------------------------------------------@@ -911,67 +932,67 @@ instance GetPName PName1F where marshalGetPName pn = case pn of- GetCurrentFogCoord -> Just gl_CURRENT_FOG_COORD+ GetCurrentFogCoord -> Just GL_CURRENT_FOG_COORD -- Rasterization- GetZoomX -> Just gl_ZOOM_X- GetZoomY -> Just gl_ZOOM_Y+ GetZoomX -> Just GL_ZOOM_X+ GetZoomY -> Just GL_ZOOM_Y -- Colors- GetMaxShininess -> Just gl_MAX_SHININESS_NV- GetMaxSpotExponent -> Just gl_MAX_SPOT_EXPONENT_NV+ GetMaxShininess -> Just GL_MAX_SHININESS_NV+ GetMaxSpotExponent -> Just GL_MAX_SPOT_EXPONENT_NV -- Fog- GetFogStart -> Just gl_FOG_START- GetFogEnd -> Just gl_FOG_END- GetFogDensity -> Just gl_FOG_DENSITY+ GetFogStart -> Just GL_FOG_START+ GetFogEnd -> Just GL_FOG_END+ GetFogDensity -> Just GL_FOG_DENSITY -- Framebuffer- GetDepthClearValue -> Just gl_DEPTH_CLEAR_VALUE- GetIndexClearValue -> Just gl_INDEX_CLEAR_VALUE+ GetDepthClearValue -> Just GL_DEPTH_CLEAR_VALUE+ GetIndexClearValue -> Just GL_INDEX_CLEAR_VALUE -- RasterPos- GetCurrentRasterDistance -> Just gl_CURRENT_RASTER_DISTANCE+ GetCurrentRasterDistance -> Just GL_CURRENT_RASTER_DISTANCE -- Point- GetPointSizeMin -> Just gl_POINT_SIZE_MIN- GetPointSizeMax -> Just gl_POINT_SIZE_MAX- GetPointFadeThresholdSize -> Just gl_POINT_FADE_THRESHOLD_SIZE- GetSmoothPointSizeGranularity -> Just gl_POINT_SIZE_GRANULARITY- GetPointSize -> Just gl_POINT_SIZE+ GetPointSizeMin -> Just GL_POINT_SIZE_MIN+ GetPointSizeMax -> Just GL_POINT_SIZE_MAX+ GetPointFadeThresholdSize -> Just GL_POINT_FADE_THRESHOLD_SIZE+ GetSmoothPointSizeGranularity -> Just GL_POINT_SIZE_GRANULARITY+ GetPointSize -> Just GL_POINT_SIZE -- LineSegment- GetSmoothLineWidthGranularity -> Just gl_SMOOTH_LINE_WIDTH_GRANULARITY- GetLineWidth -> Just gl_LINE_WIDTH+ GetSmoothLineWidthGranularity -> Just GL_SMOOTH_LINE_WIDTH_GRANULARITY+ GetLineWidth -> Just GL_LINE_WIDTH -- PerFragment- GetSampleCoverageValue -> Just gl_SAMPLE_COVERAGE_VALUE- GetAlphaTestRef -> Just gl_ALPHA_TEST_REF+ GetSampleCoverageValue -> Just GL_SAMPLE_COVERAGE_VALUE+ GetAlphaTestRef -> Just GL_ALPHA_TEST_REF -- PixelTransfer- GetRedScale -> Just gl_RED_SCALE- GetRedBias -> Just gl_RED_BIAS- GetGreenScale -> Just gl_GREEN_SCALE- GetGreenBias -> Just gl_GREEN_BIAS- GetBlueScale -> Just gl_BLUE_SCALE- GetBlueBias -> Just gl_BLUE_BIAS- GetAlphaScale -> Just gl_ALPHA_SCALE- GetAlphaBias -> Just gl_ALPHA_BIAS- GetPostConvolutionRedScale -> Just gl_POST_CONVOLUTION_RED_SCALE- GetPostConvolutionGreenScale -> Just gl_POST_CONVOLUTION_GREEN_SCALE- GetPostConvolutionBlueScale -> Just gl_POST_CONVOLUTION_BLUE_SCALE- GetPostConvolutionAlphaScale -> Just gl_POST_CONVOLUTION_ALPHA_SCALE- GetPostConvolutionRedBias -> Just gl_POST_CONVOLUTION_RED_BIAS- GetPostConvolutionGreenBias -> Just gl_POST_CONVOLUTION_GREEN_BIAS- GetPostConvolutionBlueBias -> Just gl_POST_CONVOLUTION_BLUE_BIAS- GetPostConvolutionAlphaBias -> Just gl_POST_CONVOLUTION_ALPHA_BIAS- GetPostColorMatrixRedScale -> Just gl_POST_COLOR_MATRIX_RED_SCALE- GetPostColorMatrixGreenScale -> Just gl_POST_COLOR_MATRIX_GREEN_SCALE- GetPostColorMatrixBlueScale -> Just gl_POST_COLOR_MATRIX_BLUE_SCALE- GetPostColorMatrixAlphaScale -> Just gl_POST_COLOR_MATRIX_ALPHA_SCALE- GetPostColorMatrixRedBias -> Just gl_POST_COLOR_MATRIX_RED_BIAS- GetPostColorMatrixGreenBias -> Just gl_POST_COLOR_MATRIX_GREEN_BIAS- GetPostColorMatrixBlueBias -> Just gl_POST_COLOR_MATRIX_BLUE_BIAS- GetPostColorMatrixAlphaBias -> Just gl_POST_COLOR_MATRIX_ALPHA_BIAS- GetDepthScale -> Just gl_DEPTH_SCALE- GetDepthBias -> Just gl_DEPTH_BIAS+ GetRedScale -> Just GL_RED_SCALE+ GetRedBias -> Just GL_RED_BIAS+ GetGreenScale -> Just GL_GREEN_SCALE+ GetGreenBias -> Just GL_GREEN_BIAS+ GetBlueScale -> Just GL_BLUE_SCALE+ GetBlueBias -> Just GL_BLUE_BIAS+ GetAlphaScale -> Just GL_ALPHA_SCALE+ GetAlphaBias -> Just GL_ALPHA_BIAS+ GetPostConvolutionRedScale -> Just GL_POST_CONVOLUTION_RED_SCALE+ GetPostConvolutionGreenScale -> Just GL_POST_CONVOLUTION_GREEN_SCALE+ GetPostConvolutionBlueScale -> Just GL_POST_CONVOLUTION_BLUE_SCALE+ GetPostConvolutionAlphaScale -> Just GL_POST_CONVOLUTION_ALPHA_SCALE+ GetPostConvolutionRedBias -> Just GL_POST_CONVOLUTION_RED_BIAS+ GetPostConvolutionGreenBias -> Just GL_POST_CONVOLUTION_GREEN_BIAS+ GetPostConvolutionBlueBias -> Just GL_POST_CONVOLUTION_BLUE_BIAS+ GetPostConvolutionAlphaBias -> Just GL_POST_CONVOLUTION_ALPHA_BIAS+ GetPostColorMatrixRedScale -> Just GL_POST_COLOR_MATRIX_RED_SCALE+ GetPostColorMatrixGreenScale -> Just GL_POST_COLOR_MATRIX_GREEN_SCALE+ GetPostColorMatrixBlueScale -> Just GL_POST_COLOR_MATRIX_BLUE_SCALE+ GetPostColorMatrixAlphaScale -> Just GL_POST_COLOR_MATRIX_ALPHA_SCALE+ GetPostColorMatrixRedBias -> Just GL_POST_COLOR_MATRIX_RED_BIAS+ GetPostColorMatrixGreenBias -> Just GL_POST_COLOR_MATRIX_GREEN_BIAS+ GetPostColorMatrixBlueBias -> Just GL_POST_COLOR_MATRIX_BLUE_BIAS+ GetPostColorMatrixAlphaBias -> Just GL_POST_COLOR_MATRIX_ALPHA_BIAS+ GetDepthScale -> Just GL_DEPTH_SCALE+ GetDepthBias -> Just GL_DEPTH_BIAS -- Polygons- GetPolygonOffsetFactor -> Just gl_POLYGON_OFFSET_FACTOR- GetPolygonOffsetUnits -> Just gl_POLYGON_OFFSET_UNITS+ GetPolygonOffsetFactor -> Just GL_POLYGON_OFFSET_FACTOR+ GetPolygonOffsetUnits -> Just GL_POLYGON_OFFSET_UNITS -- Texture parameters- GetMaxTextureMaxAnisotropy -> Just gl_MAX_TEXTURE_MAX_ANISOTROPY_EXT- GetMaxTextureLODBias -> Just gl_MAX_TEXTURE_LOD_BIAS+ GetMaxTextureMaxAnisotropy -> Just GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT+ GetMaxTextureLODBias -> Just GL_MAX_TEXTURE_LOD_BIAS ----------------------------------------------------------------------------- @@ -993,18 +1014,18 @@ instance GetPName IPName1I where marshalGetPName pn = case pn of- GetAtomicCounterBuffer -> Just gl_ATOMIC_COUNTER_BUFFER- GetAtomicCounterBufferStart -> Just gl_ATOMIC_COUNTER_BUFFER_START- GetAtomicCounterBufferSize -> Just gl_ATOMIC_COUNTER_BUFFER_SIZE- GetShaderStorageBuffer -> Just gl_SHADER_STORAGE_BUFFER- GetShaderStorageBufferStart -> Just gl_SHADER_STORAGE_BUFFER_START- GetShaderStorageBufferSize -> Just gl_SHADER_STORAGE_BUFFER_SIZE- GetTransformFeedbackBuffer -> Just gl_TRANSFORM_FEEDBACK_BUFFER- GetTransformFeedbackBufferStart -> Just gl_TRANSFORM_FEEDBACK_BUFFER_START- GetTransformFeedbackBufferSize -> Just gl_TRANSFORM_FEEDBACK_BUFFER_SIZE- GetUniformBuffer -> Just gl_UNIFORM_BUFFER- GetUniformBufferStart -> Just gl_UNIFORM_BUFFER_START- GetUniformBufferSize -> Just gl_UNIFORM_BUFFER_SIZE+ GetAtomicCounterBuffer -> Just GL_ATOMIC_COUNTER_BUFFER+ GetAtomicCounterBufferStart -> Just GL_ATOMIC_COUNTER_BUFFER_START+ GetAtomicCounterBufferSize -> Just GL_ATOMIC_COUNTER_BUFFER_SIZE+ GetShaderStorageBuffer -> Just GL_SHADER_STORAGE_BUFFER+ GetShaderStorageBufferStart -> Just GL_SHADER_STORAGE_BUFFER_START+ GetShaderStorageBufferSize -> Just GL_SHADER_STORAGE_BUFFER_SIZE+ GetTransformFeedbackBuffer -> Just GL_TRANSFORM_FEEDBACK_BUFFER+ GetTransformFeedbackBufferStart -> Just GL_TRANSFORM_FEEDBACK_BUFFER_START+ GetTransformFeedbackBufferSize -> Just GL_TRANSFORM_FEEDBACK_BUFFER_SIZE+ GetUniformBuffer -> Just GL_UNIFORM_BUFFER+ GetUniformBufferStart -> Just GL_UNIFORM_BUFFER_START+ GetUniformBufferSize -> Just GL_UNIFORM_BUFFER_SIZE ----------------------------------------------------------------------------- @@ -1021,11 +1042,11 @@ instance GetPName PName2I where marshalGetPName pn = case pn of -- coordtrans- GetMaxViewportDims -> Just gl_MAX_VIEWPORT_DIMS+ GetMaxViewportDims -> Just GL_MAX_VIEWPORT_DIMS -- Evaluators- GetMap2GridSegments -> Just gl_MAP2_GRID_SEGMENTS+ GetMap2GridSegments -> Just GL_MAP2_GRID_SEGMENTS -- Polygons- GetPolygonMode -> Just gl_POLYGON_MODE+ GetPolygonMode -> Just GL_POLYGON_MODE ----------------------------------------------------------------------------- @@ -1042,23 +1063,27 @@ | GetSmoothLineWidthRange -- ^ float -- PerFragment | GetDepthBounds -- ^ clampd+ -- Tessellation+ | GetPatchDefaultInnerLevel -- ^ float instance GetPName2F PName2F where instance GetPName PName2F where marshalGetPName pn = case pn of -- coord trans- GetDepthRange -> Just gl_DEPTH_RANGE+ GetDepthRange -> Just GL_DEPTH_RANGE -- Evaluators- GetMap1GridDomain -> Just gl_MAP1_GRID_DOMAIN+ GetMap1GridDomain -> Just GL_MAP1_GRID_DOMAIN -- Point- GetAliasedPointSizeRange -> Just gl_ALIASED_POINT_SIZE_RANGE- GetSmoothPointSizeRange -> Just gl_POINT_SIZE_RANGE+ GetAliasedPointSizeRange -> Just GL_ALIASED_POINT_SIZE_RANGE+ GetSmoothPointSizeRange -> Just GL_POINT_SIZE_RANGE -- LineSegments- GetAliasedLineWidthRange -> Just gl_ALIASED_LINE_WIDTH_RANGE- GetSmoothLineWidthRange -> Just gl_SMOOTH_LINE_WIDTH_RANGE+ GetAliasedLineWidthRange -> Just GL_ALIASED_LINE_WIDTH_RANGE+ GetSmoothLineWidthRange -> Just GL_SMOOTH_LINE_WIDTH_RANGE -- PerFragment- GetDepthBounds -> Just gl_DEPTH_BOUNDS_EXT+ GetDepthBounds -> Just GL_DEPTH_BOUNDS_EXT+ -- Tessellation+ GetPatchDefaultInnerLevel -> Just GL_PATCH_DEFAULT_INNER_LEVEL ----------------------------------------------------------------------------- @@ -1071,9 +1096,9 @@ instance GetPName PName3F where marshalGetPName pn = case pn of- GetCurrentNormal -> Just gl_CURRENT_NORMAL+ GetCurrentNormal -> Just GL_CURRENT_NORMAL -- Point- GetPointDistanceAttenuation -> Just gl_POINT_DISTANCE_ATTENUATION+ GetPointDistanceAttenuation -> Just GL_POINT_DISTANCE_ATTENUATION ----------------------------------------------------------------------------- @@ -1091,11 +1116,11 @@ instance GetPName PName4I where marshalGetPName pn = case pn of -- coordtrans- GetViewport -> Just gl_VIEWPORT+ GetViewport -> Just GL_VIEWPORT -- Framebuffer- GetRGBASignedComponents -> Just gl_RGBA_SIGNED_COMPONENTS_EXT+ GetRGBASignedComponents -> Just GL_RGBA_SIGNED_COMPONENTS_EXT -- PerFragement- GetScissorBox -> Just gl_SCISSOR_BOX+ GetScissorBox -> Just GL_SCISSOR_BOX -- | Both indexed and unindexed@@ -1108,7 +1133,7 @@ instance GetPName PName4ISemiIndexed where marshalGetPName pn = case pn of- GetColorWritemask -> Just gl_COLOR_WRITEMASK+ GetColorWritemask -> Just GL_COLOR_WRITEMASK ----------------------------------------------------------------------------- @@ -1130,38 +1155,41 @@ | GetCurrentRasterSecondaryColor -- ^ float | GetCurrentRasterTextureCoords -- ^ float | GetCurrentRasterPosition -- ^ float+ -- PerFragment | GetBlendColor -- ^ clampf+ -- Tessellation+ | GetPatchDefaultOuterLevel -- ^ float instance GetPName4F PName4F where instance GetPName PName4F where marshalGetPName pn = case pn of- GetCurrentColor -> Just gl_CURRENT_COLOR- GetCurrentTextureCoords -> Just gl_CURRENT_TEXTURE_COORDS- GetCurrentSecondaryColor -> Just gl_CURRENT_SECONDARY_COLOR+ GetCurrentColor -> Just GL_CURRENT_COLOR+ GetCurrentTextureCoords -> Just GL_CURRENT_TEXTURE_COORDS+ GetCurrentSecondaryColor -> Just GL_CURRENT_SECONDARY_COLOR -- Colors- GetLightModelAmbient -> Just gl_LIGHT_MODEL_AMBIENT+ GetLightModelAmbient -> Just GL_LIGHT_MODEL_AMBIENT -- Evaluators- GetMap2GridDomain -> Just gl_MAP2_GRID_DOMAIN+ GetMap2GridDomain -> Just GL_MAP2_GRID_DOMAIN -- Fog- GetFogColor -> Just gl_FOG_COLOR+ GetFogColor -> Just GL_FOG_COLOR -- Framebuffer- GetColorClearValue -> Just gl_COLOR_CLEAR_VALUE- GetAccumClearValue -> Just gl_ACCUM_CLEAR_VALUE- -- Rasterpos- GetCurrentRasterColor -> Just gl_CURRENT_RASTER_COLOR- GetCurrentRasterSecondaryColor -> Just gl_CURRENT_RASTER_SECONDARY_COLOR- GetCurrentRasterTextureCoords -> Just gl_CURRENT_RASTER_TEXTURE_COORDS- GetCurrentRasterPosition -> Just gl_CURRENT_RASTER_POSITION+ GetColorClearValue -> Just GL_COLOR_CLEAR_VALUE+ GetAccumClearValue -> Just GL_ACCUM_CLEAR_VALUE+ -- RasterPos+ GetCurrentRasterColor -> Just GL_CURRENT_RASTER_COLOR+ GetCurrentRasterSecondaryColor -> Just GL_CURRENT_RASTER_SECONDARY_COLOR+ GetCurrentRasterTextureCoords -> Just GL_CURRENT_RASTER_TEXTURE_COORDS+ GetCurrentRasterPosition -> Just GL_CURRENT_RASTER_POSITION -- PerFragment- GetBlendColor -> Just gl_BLEND_COLOR--+ GetBlendColor -> Just GL_BLEND_COLOR+ -- Tessellation+ GetPatchDefaultOuterLevel -> Just GL_PATCH_DEFAULT_OUTER_LEVEL -- 0x3000 through 0x3FFF are reserved for clip planes clipPlaneIndexToEnum :: GLsizei -> Maybe GLenum clipPlaneIndexToEnum i- | 0 <= i && i <= maxClipPlaneIndex = Just (gl_CLIP_DISTANCE0 + fromIntegral i)+ | 0 <= i && i <= maxClipPlaneIndex = Just (GL_CLIP_DISTANCE0 + fromIntegral i) | otherwise = Nothing maxClipPlaneIndex :: GLsizei@@ -1178,9 +1206,9 @@ instance GetPName PNameNI where marshalGetPName pn = case pn of- GetCompressedTextureFormats -> Just gl_COMPRESSED_TEXTURE_FORMATS- GetShaderBinaryFormats -> Just gl_SHADER_BINARY_FORMATS- GetProgramBinaryFormats -> Just gl_PROGRAM_BINARY_FORMATS+ GetCompressedTextureFormats -> Just GL_COMPRESSED_TEXTURE_FORMATS+ GetShaderBinaryFormats -> Just GL_SHADER_BINARY_FORMATS+ GetProgramBinaryFormats -> Just GL_PROGRAM_BINARY_FORMATS ----------------------------------------------------------------------------- @@ -1197,11 +1225,11 @@ instance GetPName PNameMatrix where marshalGetPName pn = case pn of -- coordtrans- GetModelviewMatrix -> Just gl_MODELVIEW_MATRIX- GetProjectionMatrix -> Just gl_PROJECTION_MATRIX- GetTextureMatrix -> Just gl_TEXTURE_MATRIX- GetColorMatrix -> Just gl_COLOR_MATRIX- GetMatrixPalette -> Just gl_MATRIX_PALETTE_ARB+ GetModelviewMatrix -> Just GL_MODELVIEW_MATRIX+ GetProjectionMatrix -> Just GL_PROJECTION_MATRIX+ GetTextureMatrix -> Just GL_TEXTURE_MATRIX+ GetColorMatrix -> Just GL_COLOR_MATRIX+ GetMatrixPalette -> Just GL_MATRIX_PALETTE_ARB -------------------------------------------------------------------------------- @@ -1227,20 +1255,20 @@ marshalGetPointervPName :: GetPointervPName -> GLenum marshalGetPointervPName x = case x of- DebugCallbackFunction -> gl_DEBUG_CALLBACK_FUNCTION- DebugCallbackUserParam -> gl_DEBUG_CALLBACK_USER_PARAM- SelectionBufferPointer -> gl_SELECTION_BUFFER_POINTER- FeedbackBufferPointer -> gl_FEEDBACK_BUFFER_POINTER- VertexArrayPointer -> gl_VERTEX_ARRAY_POINTER- NormalArrayPointer -> gl_NORMAL_ARRAY_POINTER- ColorArrayPointer -> gl_COLOR_ARRAY_POINTER- SecondaryColorArrayPointer -> gl_SECONDARY_COLOR_ARRAY_POINTER- IndexArrayPointer -> gl_INDEX_ARRAY_POINTER- TextureCoordArrayPointer -> gl_TEXTURE_COORD_ARRAY_POINTER- FogCoordArrayPointer -> gl_FOG_COORD_ARRAY_POINTER- EdgeFlagArrayPointer -> gl_EDGE_FLAG_ARRAY_POINTER- WeightArrayPointer -> gl_WEIGHT_ARRAY_POINTER_ARB- MatrixIndexArrayPointer -> gl_MATRIX_INDEX_ARRAY_POINTER_ARB+ DebugCallbackFunction -> GL_DEBUG_CALLBACK_FUNCTION+ DebugCallbackUserParam -> GL_DEBUG_CALLBACK_USER_PARAM+ SelectionBufferPointer -> GL_SELECTION_BUFFER_POINTER+ FeedbackBufferPointer -> GL_FEEDBACK_BUFFER_POINTER+ VertexArrayPointer -> GL_VERTEX_ARRAY_POINTER+ NormalArrayPointer -> GL_NORMAL_ARRAY_POINTER+ ColorArrayPointer -> GL_COLOR_ARRAY_POINTER+ SecondaryColorArrayPointer -> GL_SECONDARY_COLOR_ARRAY_POINTER+ IndexArrayPointer -> GL_INDEX_ARRAY_POINTER+ TextureCoordArrayPointer -> GL_TEXTURE_COORD_ARRAY_POINTER+ FogCoordArrayPointer -> GL_FOG_COORD_ARRAY_POINTER+ EdgeFlagArrayPointer -> GL_EDGE_FLAG_ARRAY_POINTER+ WeightArrayPointer -> GL_WEIGHT_ARRAY_POINTER_ARB+ MatrixIndexArrayPointer -> GL_MATRIX_INDEX_ARRAY_POINTER_ARB --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/QueryUtils/VertexAttrib.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.QueryUtils.VertexAttrib--- Copyright : (c) Sven Panne, Lars Corbijn 2009-2013+-- Copyright : (c) Sven Panne 2009-2019, Lars Corbijn 2009-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>, Jason Dagit <dagitj@gmail.com>@@ -23,7 +23,7 @@ import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -44,14 +44,14 @@ marshalGetVertexAttribPName :: GetVertexAttribPName -> GLenum marshalGetVertexAttribPName x = case x of- GetVertexAttribArrayEnabled -> gl_VERTEX_ATTRIB_ARRAY_ENABLED- GetVertexAttribArraySize -> gl_VERTEX_ATTRIB_ARRAY_SIZE- GetVertexAttribArrayStride -> gl_VERTEX_ATTRIB_ARRAY_STRIDE- GetVertexAttribArrayType -> gl_VERTEX_ATTRIB_ARRAY_TYPE- GetVertexAttribArrayNormalized -> gl_VERTEX_ATTRIB_ARRAY_NORMALIZED- GetCurrentVertexAttrib -> gl_CURRENT_VERTEX_ATTRIB- GetVertexAttribArrayBufferBinding -> gl_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING- GetVertexAttribArrayInteger -> gl_VERTEX_ATTRIB_ARRAY_INTEGER+ GetVertexAttribArrayEnabled -> GL_VERTEX_ATTRIB_ARRAY_ENABLED+ GetVertexAttribArraySize -> GL_VERTEX_ATTRIB_ARRAY_SIZE+ GetVertexAttribArrayStride -> GL_VERTEX_ATTRIB_ARRAY_STRIDE+ GetVertexAttribArrayType -> GL_VERTEX_ATTRIB_ARRAY_TYPE+ GetVertexAttribArrayNormalized -> GL_VERTEX_ATTRIB_ARRAY_NORMALIZED+ GetCurrentVertexAttrib -> GL_CURRENT_VERTEX_ATTRIB+ GetVertexAttribArrayBufferBinding -> GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING+ GetVertexAttribArrayInteger -> GL_VERTEX_ATTRIB_ARRAY_INTEGER -------------------------------------------------------------------------------- @@ -88,7 +88,7 @@ marshalGetVertexAttribPointerPName :: GetVertexAttribPointerPName -> GLenum marshalGetVertexAttribPointerPName x = case x of- VertexAttribArrayPointer -> gl_VERTEX_ATTRIB_ARRAY_POINTER+ VertexAttribArrayPointer -> GL_VERTEX_ATTRIB_ARRAY_POINTER --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/RasterPos.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.RasterPos--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -23,14 +23,14 @@ rasterPositionUnclipped ) where +import Data.StateVar import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/ReadCopyPixels.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.ReadCopyPixels--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -24,14 +24,14 @@ BlitBuffer(..), blitFramebuffer ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.BufferMode import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.PixelData import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.Filter import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -57,9 +57,9 @@ marshalPixelCopyType :: PixelCopyType -> GLenum marshalPixelCopyType x = case x of- CopyColor -> gl_COLOR- CopyDepth -> gl_DEPTH- CopyStencil -> gl_STENCIL+ CopyColor -> GL_COLOR+ CopyDepth -> GL_DEPTH+ CopyStencil -> GL_STENCIL -------------------------------------------------------------------------------- @@ -79,9 +79,9 @@ marshalBlitBuffer :: BlitBuffer -> GLbitfield marshalBlitBuffer x = case x of- ColorBuffer' -> gl_COLOR_BUFFER_BIT- StencilBuffer' -> gl_STENCIL_BUFFER_BIT- DepthBuffer' -> gl_DEPTH_BUFFER_BIT+ ColorBuffer' -> GL_COLOR_BUFFER_BIT+ StencilBuffer' -> GL_STENCIL_BUFFER_BIT+ DepthBuffer' -> GL_DEPTH_BUFFER_BIT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Rectangles.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Rectangles--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,7 +20,7 @@ import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.Tensor-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/RenderMode.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.RenderMode--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,10 +17,10 @@ RenderMode(..), withRenderMode, renderMode ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -32,15 +32,15 @@ marshalRenderMode :: RenderMode -> GLenum marshalRenderMode x = case x of- Render -> gl_RENDER- Feedback -> gl_FEEDBACK- Select -> gl_SELECT+ Render -> GL_RENDER+ Feedback -> GL_FEEDBACK+ Select -> GL_SELECT unmarshalRenderMode :: GLenum -> RenderMode unmarshalRenderMode x- | x == gl_RENDER = Render- | x == gl_FEEDBACK = Feedback- | x == gl_SELECT = Select+ | x == GL_RENDER = Render+ | x == GL_FEEDBACK = Feedback+ | x == GL_SELECT = Select | otherwise = error ("unmarshalRenderMode: illegal value " ++ show x) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/SavingState.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.SavingState--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,7 +19,7 @@ ) where import Graphics.Rendering.OpenGL.GL.Exception ( bracket_ )-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -50,28 +50,28 @@ marshalServerAttributeGroup :: ServerAttributeGroup -> GLbitfield marshalServerAttributeGroup x = case x of- CurrentAttributes -> gl_CURRENT_BIT- PointAttributes -> gl_POINT_BIT- LineAttributes -> gl_LINE_BIT- PolygonAttributes -> gl_POLYGON_BIT- PolygonStippleAttributes -> gl_POLYGON_STIPPLE_BIT- PixelModeAttributes -> gl_PIXEL_MODE_BIT- LightingAttributes -> gl_LIGHTING_BIT- FogAttributes -> gl_FOG_BIT- DepthBufferAttributes -> gl_DEPTH_BUFFER_BIT- AccumBufferAttributes -> gl_ACCUM_BUFFER_BIT- StencilBufferAttributes -> gl_STENCIL_BUFFER_BIT- ViewportAttributes -> gl_VIEWPORT_BIT- TransformAttributes -> gl_TRANSFORM_BIT- EnableAttributes -> gl_ENABLE_BIT- ColorBufferAttributes -> gl_COLOR_BUFFER_BIT- HintAttributes -> gl_HINT_BIT- EvalAttributes -> gl_EVAL_BIT- ListAttributes -> gl_LIST_BIT- TextureAttributes -> gl_TEXTURE_BIT- ScissorAttributes -> gl_SCISSOR_BIT- MultisampleAttributes -> gl_MULTISAMPLE_BIT- AllServerAttributes -> gl_ALL_ATTRIB_BITS+ CurrentAttributes -> GL_CURRENT_BIT+ PointAttributes -> GL_POINT_BIT+ LineAttributes -> GL_LINE_BIT+ PolygonAttributes -> GL_POLYGON_BIT+ PolygonStippleAttributes -> GL_POLYGON_STIPPLE_BIT+ PixelModeAttributes -> GL_PIXEL_MODE_BIT+ LightingAttributes -> GL_LIGHTING_BIT+ FogAttributes -> GL_FOG_BIT+ DepthBufferAttributes -> GL_DEPTH_BUFFER_BIT+ AccumBufferAttributes -> GL_ACCUM_BUFFER_BIT+ StencilBufferAttributes -> GL_STENCIL_BUFFER_BIT+ ViewportAttributes -> GL_VIEWPORT_BIT+ TransformAttributes -> GL_TRANSFORM_BIT+ EnableAttributes -> GL_ENABLE_BIT+ ColorBufferAttributes -> GL_COLOR_BUFFER_BIT+ HintAttributes -> GL_HINT_BIT+ EvalAttributes -> GL_EVAL_BIT+ ListAttributes -> GL_LIST_BIT+ TextureAttributes -> GL_TEXTURE_BIT+ ScissorAttributes -> GL_SCISSOR_BIT+ MultisampleAttributes -> GL_MULTISAMPLE_BIT+ AllServerAttributes -> GL_ALL_ATTRIB_BITS -------------------------------------------------------------------------------- @@ -91,9 +91,9 @@ marshalClientAttributeGroup :: ClientAttributeGroup -> GLbitfield marshalClientAttributeGroup x = case x of- PixelStoreAttributes -> gl_CLIENT_PIXEL_STORE_BIT- VertexArrayAttributes -> gl_CLIENT_VERTEX_ARRAY_BIT- AllClientAttributes -> gl_CLIENT_ALL_ATTRIB_BITS+ PixelStoreAttributes -> GL_CLIENT_PIXEL_STORE_BIT+ VertexArrayAttributes -> GL_CLIENT_VERTEX_ARRAY_BIT+ AllClientAttributes -> GL_CLIENT_ALL_ATTRIB_BITS --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Selection.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Selection--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,14 +18,14 @@ RenderMode(..), renderMode ) where +import Data.StateVar import Foreign.Marshal.Array import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.Exception import Graphics.Rendering.OpenGL.GL.IOState import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.RenderMode-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/Shaders/Attribs.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Attribs--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,12 +17,12 @@ attribLocation, VariableType(..), activeAttribs, ) where +import Data.StateVar import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Program import Graphics.Rendering.OpenGL.GL.Shaders.Variables-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/Limits.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Limits--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,13 +15,12 @@ module Graphics.Rendering.OpenGL.GL.Shaders.Limits ( maxVertexTextureImageUnits, maxTextureImageUnits, maxCombinedTextureImageUnits, maxTextureCoords, maxVertexUniformComponents,- maxFragmentUniformComponents, maxVertexAttribs, maxVaryingFloats,- maxTessellationLevel+ maxFragmentUniformComponents, maxVertexAttribs, maxVaryingFloats ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -76,11 +75,6 @@ maxVaryingFloats :: GettableStateVar GLsizei maxVaryingFloats = getLimit GetMaxVaryingFloats---- | Contains the maximum allowed tessellation level.--maxTessellationLevel :: GettableStateVar GLint-maxTessellationLevel = makeGettableStateVar $ getInteger1 id GetMaxTessellationLevel getLimit :: PName1I -> GettableStateVar GLsizei getLimit = makeGettableStateVar . getSizei1 id
src/Graphics/Rendering/OpenGL/GL/Shaders/Program.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Program--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,13 +20,16 @@ programVar1, programVar3 ) where -import Foreign.Marshal.Utils-import Foreign.Ptr+import Control.Monad.IO.Class+import Data.ObjectName+import Data.StateVar+import Foreign.Marshal.Utils ( with )+import Foreign.Ptr ( Ptr )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- @@ -34,9 +37,12 @@ deriving ( Eq, Ord, Show ) instance ObjectName Program where- isObjectName = fmap unmarshalGLboolean . glIsProgram . programID- deleteObjectName = glDeleteProgram . programID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsProgram . programID+ deleteObjectName = liftIO . glDeleteProgram . programID +instance CanBeLabeled Program where+ objectLabel = objectNameLabel GL_PROGRAM . programID+ -------------------------------------------------------------------------------- data GetProgramPName =@@ -71,34 +77,34 @@ marshalGetProgramPName :: GetProgramPName -> GLenum marshalGetProgramPName x = case x of- ProgramDeleteStatus -> gl_DELETE_STATUS- LinkStatus -> gl_LINK_STATUS- ValidateStatus -> gl_VALIDATE_STATUS- ProgramInfoLogLength -> gl_INFO_LOG_LENGTH- AttachedShaders -> gl_ATTACHED_SHADERS- ActiveAttributes -> gl_ACTIVE_ATTRIBUTES- ActiveAttributeMaxLength -> gl_ACTIVE_ATTRIBUTE_MAX_LENGTH- ActiveUniforms -> gl_ACTIVE_UNIFORMS- ActiveUniformMaxLength -> gl_ACTIVE_UNIFORM_MAX_LENGTH- TransformFeedbackBufferMode -> gl_TRANSFORM_FEEDBACK_BUFFER_MODE- TransformFeedbackVaryings -> gl_TRANSFORM_FEEDBACK_VARYINGS- TransformFeedbackVaryingMaxLength -> gl_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH- ActiveUniformBlocks -> gl_ACTIVE_UNIFORM_BLOCKS- ActiveUniformBlockMaxNameLength -> gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH- GeometryVerticesOut -> gl_GEOMETRY_VERTICES_OUT- GeometryInputType -> gl_GEOMETRY_INPUT_TYPE- GeometryOutputType -> gl_GEOMETRY_OUTPUT_TYPE- GeometryShaderInvocations -> gl_GEOMETRY_SHADER_INVOCATIONS- TessControlOutputVertices -> gl_TESS_CONTROL_OUTPUT_VERTICES- TessGenMode -> gl_TESS_GEN_MODE- TessGenSpacing -> gl_TESS_GEN_SPACING- TessGenVertexOrder -> gl_TESS_GEN_VERTEX_ORDER- TessGenPointMode -> gl_TESS_GEN_POINT_MODE- ComputeWorkGroupSize -> gl_COMPUTE_WORK_GROUP_SIZE- ProgramSeparable -> gl_PROGRAM_SEPARABLE- ProgramBinaryRetrievableHint -> gl_PROGRAM_BINARY_RETRIEVABLE_HINT- ActiveAtomicCounterBuffers -> gl_ACTIVE_ATOMIC_COUNTER_BUFFERS- ProgramBinaryLength -> gl_PROGRAM_BINARY_LENGTH+ ProgramDeleteStatus -> GL_DELETE_STATUS+ LinkStatus -> GL_LINK_STATUS+ ValidateStatus -> GL_VALIDATE_STATUS+ ProgramInfoLogLength -> GL_INFO_LOG_LENGTH+ AttachedShaders -> GL_ATTACHED_SHADERS+ ActiveAttributes -> GL_ACTIVE_ATTRIBUTES+ ActiveAttributeMaxLength -> GL_ACTIVE_ATTRIBUTE_MAX_LENGTH+ ActiveUniforms -> GL_ACTIVE_UNIFORMS+ ActiveUniformMaxLength -> GL_ACTIVE_UNIFORM_MAX_LENGTH+ TransformFeedbackBufferMode -> GL_TRANSFORM_FEEDBACK_BUFFER_MODE+ TransformFeedbackVaryings -> GL_TRANSFORM_FEEDBACK_VARYINGS+ TransformFeedbackVaryingMaxLength -> GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH+ ActiveUniformBlocks -> GL_ACTIVE_UNIFORM_BLOCKS+ ActiveUniformBlockMaxNameLength -> GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH+ GeometryVerticesOut -> GL_GEOMETRY_VERTICES_OUT+ GeometryInputType -> GL_GEOMETRY_INPUT_TYPE+ GeometryOutputType -> GL_GEOMETRY_OUTPUT_TYPE+ GeometryShaderInvocations -> GL_GEOMETRY_SHADER_INVOCATIONS+ TessControlOutputVertices -> GL_TESS_CONTROL_OUTPUT_VERTICES+ TessGenMode -> GL_TESS_GEN_MODE+ TessGenSpacing -> GL_TESS_GEN_SPACING+ TessGenVertexOrder -> GL_TESS_GEN_VERTEX_ORDER+ TessGenPointMode -> GL_TESS_GEN_POINT_MODE+ ComputeWorkGroupSize -> GL_COMPUTE_WORK_GROUP_SIZE+ ProgramSeparable -> GL_PROGRAM_SEPARABLE+ ProgramBinaryRetrievableHint -> GL_PROGRAM_BINARY_RETRIEVABLE_HINT+ ActiveAtomicCounterBuffers -> GL_ACTIVE_ATOMIC_COUNTER_BUFFERS+ ProgramBinaryLength -> GL_PROGRAM_BINARY_LENGTH programVar1 :: (GLint -> a) -> GetProgramPName -> Program -> GettableStateVar a programVar1 = programVarN . peek1
src/Graphics/Rendering/OpenGL/GL/Shaders/ProgramBinaries.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.ProgramBinaries--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,13 +18,13 @@ ProgramBinary(..), programBinary ) where +import Data.StateVar import Foreign.Marshal.Alloc import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Program-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/ProgramObjects.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.ProgramObjects--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -39,6 +39,7 @@ import Data.List import Data.Maybe+import Data.StateVar import Foreign.Marshal.Array import Foreign.Ptr import Graphics.Rendering.OpenGL.GL.ByteString@@ -47,8 +48,7 @@ import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Program import Graphics.Rendering.OpenGL.GL.Shaders.Shader-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/Shader.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Shader--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,9 +17,12 @@ Shader(..) ) where +import Control.Monad.IO.Class+import Data.ObjectName+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- @@ -27,5 +30,8 @@ deriving ( Eq, Ord, Show ) instance ObjectName Shader where- isObjectName = fmap unmarshalGLboolean . glIsShader . shaderID- deleteObjectName = glDeleteShader . shaderID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsShader . shaderID+ deleteObjectName = liftIO . glDeleteShader . shaderID++instance CanBeLabeled Shader where+ objectLabel = objectNameLabel GL_SHADER . shaderID
src/Graphics/Rendering/OpenGL/GL/Shaders/ShaderBinaries.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.ShaderBinaries--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,12 +18,12 @@ ShaderBinary(..), shaderBinary, ) where +import Data.StateVar import Foreign.Marshal.Array import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Shader-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/ShaderObjects.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.ShaderObjects--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -28,6 +28,7 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Array import Foreign.Marshal.Utils@@ -37,8 +38,7 @@ import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Shader-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -59,21 +59,21 @@ marshalShaderType :: ShaderType -> GLenum marshalShaderType x = case x of- VertexShader -> gl_VERTEX_SHADER- TessControlShader -> gl_TESS_CONTROL_SHADER- TessEvaluationShader -> gl_TESS_EVALUATION_SHADER- GeometryShader -> gl_GEOMETRY_SHADER- FragmentShader -> gl_FRAGMENT_SHADER- ComputeShader -> gl_COMPUTE_SHADER+ VertexShader -> GL_VERTEX_SHADER+ TessControlShader -> GL_TESS_CONTROL_SHADER+ TessEvaluationShader -> GL_TESS_EVALUATION_SHADER+ GeometryShader -> GL_GEOMETRY_SHADER+ FragmentShader -> GL_FRAGMENT_SHADER+ ComputeShader -> GL_COMPUTE_SHADER unmarshalShaderType :: GLenum -> ShaderType unmarshalShaderType x- | x == gl_VERTEX_SHADER = VertexShader- | x == gl_TESS_CONTROL_SHADER = TessControlShader- | x == gl_TESS_EVALUATION_SHADER = TessEvaluationShader- | x == gl_GEOMETRY_SHADER = GeometryShader- | x == gl_FRAGMENT_SHADER = FragmentShader- | x == gl_COMPUTE_SHADER = ComputeShader+ | x == GL_VERTEX_SHADER = VertexShader+ | x == GL_TESS_CONTROL_SHADER = TessControlShader+ | x == GL_TESS_EVALUATION_SHADER = TessEvaluationShader+ | x == GL_GEOMETRY_SHADER = GeometryShader+ | x == GL_FRAGMENT_SHADER = FragmentShader+ | x == GL_COMPUTE_SHADER = ComputeShader | otherwise = error ("unmarshalShaderType: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -147,11 +147,11 @@ marshalGetShaderPName :: GetShaderPName -> GLenum marshalGetShaderPName x = case x of- ShaderDeleteStatus -> gl_DELETE_STATUS- CompileStatus -> gl_COMPILE_STATUS- ShaderInfoLogLength -> gl_INFO_LOG_LENGTH- ShaderSourceLength -> gl_SHADER_SOURCE_LENGTH- ShaderType -> gl_SHADER_TYPE+ ShaderDeleteStatus -> GL_DELETE_STATUS+ CompileStatus -> GL_COMPILE_STATUS+ ShaderInfoLogLength -> GL_INFO_LOG_LENGTH+ ShaderSourceLength -> GL_SHADER_SOURCE_LENGTH+ ShaderType -> GL_SHADER_TYPE shaderVar :: (GLint -> a) -> GetShaderPName -> Shader -> GettableStateVar a shaderVar f p shader =@@ -173,12 +173,12 @@ marshalPrecisionType :: PrecisionType -> GLenum marshalPrecisionType x = case x of- LowFloat -> gl_LOW_FLOAT- MediumFloat -> gl_MEDIUM_FLOAT- HighFloat -> gl_HIGH_FLOAT- LowInt -> gl_LOW_INT- MediumInt -> gl_MEDIUM_INT- HighInt -> gl_HIGH_INT+ LowFloat -> GL_LOW_FLOAT+ MediumFloat -> GL_MEDIUM_FLOAT+ HighFloat -> GL_HIGH_FLOAT+ LowInt -> GL_LOW_INT+ MediumInt -> GL_MEDIUM_INT+ HighInt -> GL_HIGH_INT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/Uniform.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE TypeSynonymInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Uniform--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -13,8 +14,6 @@ -- ----------------------------------------------------------------------------- -{-# LANGUAGE TypeSynonymInstances #-}- module Graphics.Rendering.OpenGL.GL.Shaders.Uniform ( -- * Uniform variables UniformLocation(..), uniformLocation, activeUniforms, Uniform(..),@@ -24,17 +23,20 @@ ) where import Data.Maybe+import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.ByteString+import Graphics.Rendering.OpenGL.GL.CoordTrans+import Graphics.Rendering.OpenGL.GL.GLboolean+import Graphics.Rendering.OpenGL.GL.MatrixComponent import Graphics.Rendering.OpenGL.GL.Shaders.Program import Graphics.Rendering.OpenGL.GL.Shaders.ProgramObjects import Graphics.Rendering.OpenGL.GL.Shaders.Variables-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -74,7 +76,7 @@ uniform3 :: UniformLocation -> a -> a -> a -> IO () uniform4 :: UniformLocation -> a -> a -> a -> a -> IO () - getUniform :: Storable (b a) => Program -> UniformLocation -> Ptr (b a) -> IO ()+ getUniform :: Storable (b a) => GLuint -> GLint -> Ptr (b a) -> IO () uniform1v :: UniformLocation -> GLsizei -> Ptr a -> IO () uniform2v :: UniformLocation -> GLsizei -> Ptr a -> IO ()@@ -87,7 +89,7 @@ uniform3 (UniformLocation ul) = glUniform3i ul uniform4 (UniformLocation ul) = glUniform4i ul - getUniform (Program p) (UniformLocation ul) = glGetUniformiv p ul . castPtr+ getUniform p ul = glGetUniformiv p ul . castPtr uniform1v (UniformLocation ul) = glUniform1iv ul uniform2v (UniformLocation ul) = glUniform2iv ul@@ -100,7 +102,7 @@ uniform3 (UniformLocation ul) = glUniform3ui ul uniform4 (UniformLocation ul) = glUniform4ui ul - getUniform (Program p) (UniformLocation ul) = glGetUniformuiv p ul . castPtr+ getUniform p ul = glGetUniformuiv p ul . castPtr uniform1v (UniformLocation ul) = glUniform1uiv ul uniform2v (UniformLocation ul) = glUniform2uiv ul@@ -113,13 +115,26 @@ uniform3 (UniformLocation ul) = glUniform3f ul uniform4 (UniformLocation ul) = glUniform4f ul - getUniform (Program p) (UniformLocation ul) = glGetUniformfv p ul . castPtr+ getUniform p ul = glGetUniformfv p ul . castPtr uniform1v (UniformLocation ul) = glUniform1fv ul uniform2v (UniformLocation ul) = glUniform2fv ul uniform3v (UniformLocation ul) = glUniform3fv ul uniform4v (UniformLocation ul) = glUniform4fv ul +instance UniformComponent GLdouble where+ uniform1 (UniformLocation ul) = glUniform1d ul+ uniform2 (UniformLocation ul) = glUniform2d ul+ uniform3 (UniformLocation ul) = glUniform3d ul+ uniform4 (UniformLocation ul) = glUniform4d ul++ getUniform p ul = glGetUniformdv p ul . castPtr++ uniform1v (UniformLocation ul) = glUniform1dv ul+ uniform2v (UniformLocation ul) = glUniform2dv ul+ uniform3v (UniformLocation ul) = glUniform3dv ul+ uniform4v (UniformLocation ul) = glUniform4dv ul+ -------------------------------------------------------------------------------- class Uniform a where@@ -139,11 +154,35 @@ => (UniformLocation -> b a -> IO ()) -> UniformLocation -> StateVar (b a) makeUniformVar setter location = makeStateVar getter (setter location)- where getter = do program <- fmap fromJust $ get currentProgram- allocaBytes maxUniformBufferSize $ \buf -> do- getUniform program location buf- peek buf+ where getter = allocaBytes maxUniformBufferSize $ \buf -> do+ getUniformWith getUniform location buf+ peek buf +single :: (UniformLocation -> StateVar (Vertex1 a))+ -> (UniformLocation -> StateVar a)+single var location = makeStateVar (do Vertex1 x <- get (var location); return x)+ (\x -> var location $= Vertex1 x)++instance Uniform GLfloat where+ uniform = single uniform+ uniformv = uniform1v++instance Uniform GLint where+ uniform = single uniform+ uniformv = uniform1v++instance Uniform GLuint where+ uniform = single uniform+ uniformv = uniform1v++instance Uniform GLdouble where+ uniform = single uniform+ uniformv = uniform1v++instance UniformComponent a => Uniform (Vertex1 a) where+ uniform = makeUniformVar $ \location (Vertex1 x) -> uniform1 location x+ uniformv location count = uniform1v location count . (castPtr :: Ptr (Vertex1 b) -> Ptr b)+ instance UniformComponent a => Uniform (Vertex2 a) where uniform = makeUniformVar $ \location (Vertex2 x y) -> uniform2 location x y uniformv location count = uniform2v location count . (castPtr :: Ptr (Vertex2 b) -> Ptr b)@@ -156,6 +195,22 @@ uniform = makeUniformVar $ \location (Vertex4 x y z w) -> uniform4 location x y z w uniformv location count = uniform4v location count . (castPtr :: Ptr (Vertex4 b) -> Ptr b) +instance UniformComponent a => Uniform (Vector1 a) where+ uniform = makeUniformVar $ \location (Vector1 x) -> uniform1 location x+ uniformv location count = uniform1v location count . (castPtr :: Ptr (Vector1 b) -> Ptr b)++instance UniformComponent a => Uniform (Vector2 a) where+ uniform = makeUniformVar $ \location (Vector2 x y) -> uniform2 location x y+ uniformv location count = uniform2v location count . (castPtr :: Ptr (Vector2 b) -> Ptr b)++instance UniformComponent a => Uniform (Vector3 a) where+ uniform = makeUniformVar $ \location (Vector3 x y z) -> uniform3 location x y z+ uniformv location count = uniform3v location count . (castPtr :: Ptr (Vector3 b) -> Ptr b)++instance UniformComponent a => Uniform (Vector4 a) where+ uniform = makeUniformVar $ \location (Vector4 x y z w) -> uniform4 location x y z w+ uniformv location count = uniform4v location count . (castPtr :: Ptr (Vector4 b) -> Ptr b)+ instance UniformComponent a => Uniform (TexCoord1 a) where uniform = makeUniformVar $ \location (TexCoord1 s) -> uniform1 location s uniformv location count = uniform1v location count . (castPtr :: Ptr (TexCoord1 b) -> Ptr b)@@ -196,13 +251,28 @@ -- getUniform. Even worse is that it requires the `GLint` uniforms while it is an enum or -- uint. instance Uniform TextureUnit where- uniform loc@(UniformLocation ul) = makeStateVar getter setter- where setter (TextureUnit tu) = uniform1 loc (fromIntegral tu :: GLint)- getter = do program <- fmap fromJust $ get currentProgram- allocaBytes (sizeOf (undefined :: GLint)) $ \buf -> do- glGetUniformiv (programID program) ul buf- tuID <- peek buf- return . TextureUnit $ fromIntegral tuID+ uniform loc = makeStateVar getter setter+ where getter = allocaBytes (sizeOf (undefined :: GLint)) $ \buf -> do+ getUniformWith glGetUniformiv loc buf+ fmap (TextureUnit . fromIntegral) $ peek buf+ setter (TextureUnit tu) = uniform1 loc (fromIntegral tu :: GLint) uniformv location count = uniform1v location count . (castPtr :: Ptr TextureUnit -> Ptr GLint)++-- | Note: 'uniformv' expects all matrices to be in 'ColumnMajor' form.+instance MatrixComponent a => Uniform (GLmatrix a) where+ uniform loc@(UniformLocation ul) = makeStateVar getter setter+ where getter = withNewMatrix ColumnMajor $ getUniformWith getUniformv loc+ setter m = withMatrix m $ uniformMatrix4v ul 1 . isRowMajor+ uniformv (UniformLocation ul) count buf =+ uniformMatrix4v ul count (marshalGLboolean False) (castPtr buf `asTypeOf` elemType buf)+ where elemType = undefined :: MatrixComponent c => Ptr (GLmatrix c) -> Ptr c++isRowMajor :: MatrixOrder -> GLboolean+isRowMajor = marshalGLboolean . (RowMajor ==)++getUniformWith :: (GLuint -> GLint -> Ptr a -> IO ()) -> UniformLocation -> Ptr a -> IO ()+getUniformWith getter (UniformLocation ul) buf = do+ program <- fmap (programID . fromJust) $ get currentProgram+ getter program ul buf --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Shaders/Variables.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Shaders.Variables--- Copyright : (c) Sven Panne 2006-2013+-- Copyright : (c) Sven Panne 2006-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,14 +19,14 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Utils import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.Shaders.Program-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -86,56 +86,56 @@ unmarshalVariableType :: GLenum -> VariableType unmarshalVariableType x- | x == gl_FLOAT = Float'- | x == gl_FLOAT_VEC2 = FloatVec2- | x == gl_FLOAT_VEC3 = FloatVec3- | x == gl_FLOAT_VEC4 = FloatVec4- | x == gl_INT = Int'- | x == gl_INT_VEC2 = IntVec2- | x == gl_INT_VEC3 = IntVec3- | x == gl_INT_VEC4 = IntVec4- | x == gl_UNSIGNED_INT = UnsignedInt'- | x == gl_UNSIGNED_INT_VEC2 = UnsignedIntVec2- | x == gl_UNSIGNED_INT_VEC3 = UnsignedIntVec3- | x == gl_UNSIGNED_INT_VEC4 = UnsignedIntVec4- | x == gl_BOOL = Bool- | x == gl_BOOL_VEC2 = BoolVec2- | x == gl_BOOL_VEC3 = BoolVec3- | x == gl_BOOL_VEC4 = BoolVec4- | x == gl_FLOAT_MAT2 = FloatMat2- | x == gl_FLOAT_MAT3 = FloatMat3- | x == gl_FLOAT_MAT4 = FloatMat4- | x == gl_FLOAT_MAT2x3 = FloatMat2x3- | x == gl_FLOAT_MAT2x4 = FloatMat2x4- | x == gl_FLOAT_MAT3x2 = FloatMat3x2- | x == gl_FLOAT_MAT3x4 = FloatMat3x4- | x == gl_FLOAT_MAT4x2 = FloatMat4x2- | x == gl_FLOAT_MAT4x3 = FloatMat4x3- | x == gl_SAMPLER_1D = Sampler1D- | x == gl_SAMPLER_2D = Sampler2D- | x == gl_SAMPLER_3D = Sampler3D- | x == gl_SAMPLER_CUBE = SamplerCube- | x == gl_SAMPLER_1D_SHADOW = Sampler1DShadow- | x == gl_SAMPLER_2D_SHADOW = Sampler2DShadow- | x == gl_SAMPLER_1D_ARRAY = Sampler1DArray- | x == gl_SAMPLER_2D_ARRAY = Sampler2DArray- | x == gl_SAMPLER_1D_ARRAY_SHADOW = Sampler1DArrayShadow- | x == gl_SAMPLER_2D_ARRAY_SHADOW = Sampler2DArrayShadow- | x == gl_SAMPLER_CUBE_SHADOW = SamplerCubeShadow- | x == gl_SAMPLER_2D_RECT = Sampler2DRect- | x == gl_SAMPLER_2D_RECT_SHADOW = Sampler2DRectShadow- | x == gl_INT_SAMPLER_1D = IntSampler1D- | x == gl_INT_SAMPLER_2D = IntSampler2D- | x == gl_INT_SAMPLER_3D = IntSampler3D- | x == gl_INT_SAMPLER_CUBE = IntSamplerCube- | x == gl_INT_SAMPLER_1D_ARRAY = IntSampler1DArray- | x == gl_INT_SAMPLER_2D_ARRAY = IntSampler2DArray- | x == gl_UNSIGNED_INT_SAMPLER_1D = UnsignedIntSampler1D- | x == gl_UNSIGNED_INT_SAMPLER_2D = UnsignedIntSampler2D- | x == gl_UNSIGNED_INT_SAMPLER_3D = UnsignedIntSampler3D- | x == gl_UNSIGNED_INT_SAMPLER_CUBE = UnsignedIntSamplerCube- | x == gl_UNSIGNED_INT_SAMPLER_1D_ARRAY = UnsignedIntSampler1DArray- | x == gl_UNSIGNED_INT_SAMPLER_2D_ARRAY = UnsignedIntSampler2DArray+ | x == GL_FLOAT = Float'+ | x == GL_FLOAT_VEC2 = FloatVec2+ | x == GL_FLOAT_VEC3 = FloatVec3+ | x == GL_FLOAT_VEC4 = FloatVec4+ | x == GL_INT = Int'+ | x == GL_INT_VEC2 = IntVec2+ | x == GL_INT_VEC3 = IntVec3+ | x == GL_INT_VEC4 = IntVec4+ | x == GL_UNSIGNED_INT = UnsignedInt'+ | x == GL_UNSIGNED_INT_VEC2 = UnsignedIntVec2+ | x == GL_UNSIGNED_INT_VEC3 = UnsignedIntVec3+ | x == GL_UNSIGNED_INT_VEC4 = UnsignedIntVec4+ | x == GL_BOOL = Bool+ | x == GL_BOOL_VEC2 = BoolVec2+ | x == GL_BOOL_VEC3 = BoolVec3+ | x == GL_BOOL_VEC4 = BoolVec4+ | x == GL_FLOAT_MAT2 = FloatMat2+ | x == GL_FLOAT_MAT3 = FloatMat3+ | x == GL_FLOAT_MAT4 = FloatMat4+ | x == GL_FLOAT_MAT2x3 = FloatMat2x3+ | x == GL_FLOAT_MAT2x4 = FloatMat2x4+ | x == GL_FLOAT_MAT3x2 = FloatMat3x2+ | x == GL_FLOAT_MAT3x4 = FloatMat3x4+ | x == GL_FLOAT_MAT4x2 = FloatMat4x2+ | x == GL_FLOAT_MAT4x3 = FloatMat4x3+ | x == GL_SAMPLER_1D = Sampler1D+ | x == GL_SAMPLER_2D = Sampler2D+ | x == GL_SAMPLER_3D = Sampler3D+ | x == GL_SAMPLER_CUBE = SamplerCube+ | x == GL_SAMPLER_1D_SHADOW = Sampler1DShadow+ | x == GL_SAMPLER_2D_SHADOW = Sampler2DShadow+ | x == GL_SAMPLER_1D_ARRAY = Sampler1DArray+ | x == GL_SAMPLER_2D_ARRAY = Sampler2DArray+ | x == GL_SAMPLER_1D_ARRAY_SHADOW = Sampler1DArrayShadow+ | x == GL_SAMPLER_2D_ARRAY_SHADOW = Sampler2DArrayShadow+ | x == GL_SAMPLER_CUBE_SHADOW = SamplerCubeShadow+ | x == GL_SAMPLER_2D_RECT = Sampler2DRect+ | x == GL_SAMPLER_2D_RECT_SHADOW = Sampler2DRectShadow+ | x == GL_INT_SAMPLER_1D = IntSampler1D+ | x == GL_INT_SAMPLER_2D = IntSampler2D+ | x == GL_INT_SAMPLER_3D = IntSampler3D+ | x == GL_INT_SAMPLER_CUBE = IntSamplerCube+ | x == GL_INT_SAMPLER_1D_ARRAY = IntSampler1DArray+ | x == GL_INT_SAMPLER_2D_ARRAY = IntSampler2DArray+ | x == GL_UNSIGNED_INT_SAMPLER_1D = UnsignedIntSampler1D+ | x == GL_UNSIGNED_INT_SAMPLER_2D = UnsignedIntSampler2D+ | x == GL_UNSIGNED_INT_SAMPLER_3D = UnsignedIntSampler3D+ | x == GL_UNSIGNED_INT_SAMPLER_CUBE = UnsignedIntSamplerCube+ | x == GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = UnsignedIntSampler1DArray+ | x == GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = UnsignedIntSampler2DArray | otherwise = error ("unmarshalVariableType: illegal value " ++ show x) --------------------------------------------------------------------------------
− src/Graphics/Rendering/OpenGL/GL/StateVar.hs
@@ -1,160 +0,0 @@------------------------------------------------------------------------------------ |--- Module : Graphics.Rendering.OpenGL.GL.StateVar--- Copyright : (c) Sven Panne 2013--- License : BSD3--- --- Maintainer : Sven Panne <svenpanne@gmail.com>--- Stability : stable--- Portability : portable------ State variables are references in the IO monad, like 'IORef's or parts of--- the OpenGL state. Note that state variables are not neccessarily writable or--- readable, they may come in read-only or write-only flavours, too. As a very--- simple example for a state variable, consider an explicitly allocated memory--- buffer. This buffer can easily be converted into a 'StateVar':------ @--- makeStateVarFromPtr :: Storable a => Ptr a -> StateVar a--- makeStateVarFromPtr p = makeStateVar (peek p) (poke p)--- @------ The example below puts 11 into a state variable (i.e. into the buffer),--- increments the contents of the state variable by 22, and finally prints the--- resulting content:------ @--- do p <- malloc :: IO (Ptr Int)--- let v = makeStateVarFromPtr p--- v $= 11--- v $~ (+ 22)--- x <- get v--- print x--- @------ 'IORef's are state variables, too, so an example with them looks extremely--- similiar:------ @--- do v <- newIORef (0 :: Int)--- v $= 11--- v $~ (+ 22)--- x <- get v--- print x--- @-----------------------------------------------------------------------------------module Graphics.Rendering.OpenGL.GL.StateVar (- -- * Readable State Variables- HasGetter(..),- GettableStateVar(..), makeGettableStateVar,- -- * Writable State Variables- HasSetter(..),- SettableStateVar(..), makeSettableStateVar,- -- * General State Variables- StateVar(..), makeStateVar,- -- * Utility Functions- ($~), ($=!), ($~!)-) where--import Control.Applicative ( Applicative(..) )-import Data.IORef ( IORef, readIORef, writeIORef )------------------------------------------------------------------------------------infixr 2 $=-------------------------------------------------------------------------------------- | The class of all readable state variables.-class HasGetter g where- -- | Read the value of a state variable.- get :: g a -> IO a--instance HasGetter IORef where- get = readIORef---- | A concrete implementation of a read-only state variable, carrying an IO--- action to read the value.-newtype GettableStateVar a = GettableStateVar (IO a)--instance HasGetter GettableStateVar where- get (GettableStateVar g) = g--instance Functor GettableStateVar where- fmap f (GettableStateVar g) = GettableStateVar (fmap f g)--instance Applicative GettableStateVar where- pure = GettableStateVar . pure- GettableStateVar g <*> GettableStateVar h = GettableStateVar (g <*> h)--instance Monad GettableStateVar where- return = pure- GettableStateVar g >>= h = GettableStateVar (g >>= get . h)---- | Construct a 'GettableStateVar' from an IO action.-makeGettableStateVar :: IO a -> GettableStateVar a-makeGettableStateVar = GettableStateVar-------------------------------------------------------------------------------------- | The class of all writable state variables.-class HasSetter s where- -- | Write a new value into a state variable.- ($=) :: s a -> a -> IO ()--instance HasSetter IORef where- ($=) = writeIORef---- | A concrete implementation of a write-only state variable, carrying an IO--- action to write the new value.-newtype SettableStateVar a = SettableStateVar (a -> IO ())--instance HasSetter SettableStateVar where- ($=) (SettableStateVar s) a = s a---- instance Contravariant SettableStateVar where--- contramap f (SettableStateVar s) = SettableStateVar (s . f)---- | Construct a 'SettableStateVar' from an IO action.-makeSettableStateVar :: (a -> IO ()) -> SettableStateVar a-makeSettableStateVar = SettableStateVar-------------------------------------------------------------------------------------- | A concrete implementation of a readable and writable state variable,--- carrying one IO action to read the value and another IO action to write the--- new value.-data StateVar a =- StateVar (GettableStateVar a) (SettableStateVar a)--instance HasGetter StateVar where- get (StateVar g _) = get g--instance HasSetter StateVar where- ($=) (StateVar _ s) a = s $= a---- | Construct a 'StateVar' from two IO actions, one for reading and one for--- writing.-makeStateVar :: IO a -> (a -> IO ()) -> StateVar a-makeStateVar g s = StateVar (makeGettableStateVar g) (makeSettableStateVar s)-------------------------------------------------------------------------------------- | A modificator convenience function, transforming the contents of a state--- variable with a given funtion.--($~) :: (HasGetter v, HasSetter v) => v a -> (a -> a) -> IO ()-v $~ f = do- x <- get v- v $= f x---- | A variant of '$=' which is strict in the value to be set.-($=!) :: HasSetter s => s a -> a -> IO ()-v $=! x = x `seq` v $= x---- | A variant of '$~' which is strict in the transformed value.-($~!) :: (HasGetter v, HasSetter v) => v a -> (a -> a) -> IO ()-v $~! f = do- x <- get v- v $=! f x
src/Graphics/Rendering/OpenGL/GL/StringQueries.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE CPP #-} -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.StringQueries--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -14,34 +15,42 @@ -------------------------------------------------------------------------------- module Graphics.Rendering.OpenGL.GL.StringQueries (- vendor, renderer, glVersion, glExtensions, shadingLanguageVersion,- majorMinor, ContextProfile'(..), contextProfile+ vendor, renderer, glVersion, glExtensions, extensionSupported,+ shadingLanguageVersion, majorMinor, ContextProfile'(..), contextProfile ) where import Data.Bits import Data.Char-import Foreign.C.String-import Foreign.Ptr+#if !MIN_VERSION_base(4,8,0)+import Data.Functor( (<$>), (<$) )+#endif+import Data.Set ( member, toList )+import Data.StateVar as S+import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL+import Text.ParserCombinators.ReadP as R -------------------------------------------------------------------------------- vendor :: GettableStateVar String-vendor = makeGettableStateVar (getString gl_VENDOR)+vendor = makeStringVar GL_VENDOR renderer :: GettableStateVar String-renderer = makeGettableStateVar (getString gl_RENDERER)+renderer = makeStringVar GL_RENDERER glVersion :: GettableStateVar String-glVersion = makeGettableStateVar (getString gl_VERSION)+glVersion = makeStringVar GL_VERSION glExtensions :: GettableStateVar [String]-glExtensions = makeGettableStateVar (fmap words $ getString gl_EXTENSIONS)+glExtensions = makeGettableStateVar (toList <$> getExtensions) +extensionSupported :: String -> GettableStateVar Bool+extensionSupported ext =+ makeGettableStateVar (getExtensions >>= (return . member ext))+ shadingLanguageVersion :: GettableStateVar String-shadingLanguageVersion = makeGettableStateVar (getString gl_SHADING_LANGUAGE_VERSION)+shadingLanguageVersion = makeStringVar GL_SHADING_LANGUAGE_VERSION -------------------------------------------------------------------------------- @@ -52,8 +61,8 @@ marshalContextProfile' :: ContextProfile' -> GLbitfield marshalContextProfile' x = case x of- CoreProfile' -> gl_CONTEXT_CORE_PROFILE_BIT- CompatibilityProfile' -> gl_CONTEXT_COMPATIBILITY_PROFILE_BIT+ CoreProfile' -> GL_CONTEXT_CORE_PROFILE_BIT+ CompatibilityProfile' -> GL_CONTEXT_COMPATIBILITY_PROFILE_BIT contextProfile :: GettableStateVar [ContextProfile'] contextProfile = makeGettableStateVar (getInteger1 i2cps GetContextProfileMask)@@ -65,8 +74,8 @@ -------------------------------------------------------------------------------- -getString :: GLenum -> IO String-getString n = glGetString n >>= maybeNullPtr (return "") (peekCString . castPtr)+makeStringVar :: GLenum -> GettableStateVar String+makeStringVar = makeGettableStateVar . getStringWith . glGetString -------------------------------------------------------------------------------- @@ -77,12 +86,30 @@ -- with a sane OpenGL implementation, it is transformed to @(-1,-1)@. majorMinor :: GettableStateVar String -> GettableStateVar (Int, Int)-majorMinor = makeGettableStateVar . fmap parse . get- where defaultVersion = (-1, -1)- parse str =- case span isDigit str of- (major@(_:_), '.':rest) ->- case span isDigit rest of- (minor@(_:_), _) -> (read major, read minor)- _ -> defaultVersion- _ -> defaultVersion+majorMinor =+ makeGettableStateVar . (runParser parseVersion (-1, -1) <$>) . S.get++--------------------------------------------------------------------------------+-- Copy from Graphics.Rendering.OpenGL.Raw.GetProcAddress... :-/++runParser :: ReadP a -> a -> String -> a+runParser parser failed str =+ case readP_to_S parser str of+ [(v, "")] -> v+ _ -> failed++-- This does quite a bit more than we need for "normal" OpenGL, but at least it+-- documents the convoluted format of the version string in detail.+parseVersion :: ReadP (Int, Int)+parseVersion = do+ _prefix <-+ -- Too lazy to define a type for the API...+ ("CL" <$ string "OpenGL ES-CL ") <++ -- OpenGL ES 1.x Common-Lite+ ("CM" <$ string "OpenGL ES-CM ") <++ -- OpenGL ES 1.x Common+ ("ES" <$ string "OpenGL ES " ) <++ -- OpenGL ES 2.x or 3.x+ ("GL" <$ string "" ) -- OpenGL+ major <- read <$> munch1 isDigit+ minor <- char '.' >> read <$> munch1 isDigit+ _release <- (char '.' >> munch1 (/= ' ')) <++ return ""+ _vendorStuff <- (char ' ' >> R.get `manyTill` eof) <++ ("" <$ eof)+ return (major, minor)
src/Graphics/Rendering/OpenGL/GL/SyncObjects.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.SyncObjects--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -25,14 +25,16 @@ SyncStatus(..), syncStatus ) where -import Foreign.Marshal.Utils-import Foreign.Ptr+import Control.Monad.IO.Class+import Data.ObjectName+import Data.StateVar+import Foreign.Marshal.Utils ( with )+import Foreign.Ptr ( nullPtr )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -40,12 +42,15 @@ deriving ( Eq, Ord, Show ) instance ObjectName SyncObject where- isObjectName = fmap unmarshalGLboolean . glIsSync . syncID- deleteObjectName = glDeleteSync . syncID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsSync . syncID+ deleteObjectName = liftIO . glDeleteSync . syncID +instance CanBeLabeled SyncObject where+ objectLabel = objectPtrLabel . syncID+ syncGpuCommandsComplete :: IO SyncObject syncGpuCommandsComplete =- fmap SyncObject $ glFenceSync gl_SYNC_GPU_COMMANDS_COMPLETE 0+ fmap SyncObject $ glFenceSync GL_SYNC_GPU_COMMANDS_COMPLETE 0 -------------------------------------------------------------------------------- @@ -58,7 +63,7 @@ marshalWaitFlag :: WaitFlag -> GLbitfield marshalWaitFlag x = case x of- SyncFlushCommands -> gl_SYNC_FLUSH_COMMANDS_BIT+ SyncFlushCommands -> GL_SYNC_FLUSH_COMMANDS_BIT -------------------------------------------------------------------------------- @@ -71,10 +76,10 @@ unmarshalWaitResult :: GLenum -> WaitResult unmarshalWaitResult x- | x == gl_ALREADY_SIGNALED = AlreadySignaled- | x == gl_TIMEOUT_EXPIRED = TimeoutExpired- | x == gl_CONDITION_SATISFIED = ConditionSatisfied- | x == gl_WAIT_FAILED = WaitFailed+ | x == GL_ALREADY_SIGNALED = AlreadySignaled+ | x == GL_TIMEOUT_EXPIRED = TimeoutExpired+ | x == GL_CONDITION_SATISFIED = ConditionSatisfied+ | x == GL_WAIT_FAILED = WaitFailed | otherwise = error ("unmarshalWaitResult: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -86,7 +91,7 @@ waitSync :: SyncObject -> IO () waitSync syncObject =- glWaitSync (syncID syncObject) 0 (fromIntegral gl_TIMEOUT_IGNORED)+ glWaitSync (syncID syncObject) 0 (fromIntegral GL_TIMEOUT_IGNORED) maxServerWaitTimeout :: GettableStateVar WaitTimeout maxServerWaitTimeout =@@ -101,13 +106,13 @@ unmarshalSyncStatus :: GLenum -> SyncStatus unmarshalSyncStatus x- | x == gl_UNSIGNALED = Unsignaled- | x == gl_SIGNALED = Signaled+ | x == GL_UNSIGNALED = Unsignaled+ | x == GL_SIGNALED = Signaled | otherwise = error ("unmarshalSyncStatus: illegal value " ++ show x) syncStatus :: SyncObject -> GettableStateVar SyncStatus syncStatus syncObject = makeGettableStateVar $ with 0 $ \buf -> do- glGetSynciv (syncID syncObject) gl_SYNC_STATUS 1 nullPtr buf+ glGetSynciv (syncID syncObject) GL_SYNC_STATUS 1 nullPtr buf peek1 (unmarshalSyncStatus . fromIntegral) buf
src/Graphics/Rendering/OpenGL/GL/Tensor.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveDataTypeable, CPP #-} -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Tensor--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,9 +19,12 @@ Vector1(..), Vector2(..), Vector3(..), Vector4(..) ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ( Applicative(..) )+import Data.Foldable ( Foldable(..) )+#endif import Control.Monad ( ap )-import Data.Foldable ( Foldable(..), foldlM )+import Data.Foldable ( foldlM ) import Data.Ix ( Ix ) import Data.Traversable ( Traversable(..), mapAccumL ) import Data.Typeable ( Typeable )
src/Graphics/Rendering/OpenGL/GL/Texturing.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GL/Texturing/Application.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Application--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,7 @@ texture ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget
src/Graphics/Rendering/OpenGL/GL/Texturing/Environments.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Environments--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,17 +22,17 @@ ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.BlendingFactor import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.Parameters import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -43,9 +43,9 @@ marshalTextureEnvTarget :: TextureEnvTarget -> GLenum marshalTextureEnvTarget x = case x of- TextureEnv -> gl_TEXTURE_ENV- TextureFilterControl -> gl_TEXTURE_FILTER_CONTROL- PointSprite -> gl_POINT_SPRITE+ TextureEnv -> GL_TEXTURE_ENV+ TextureFilterControl -> GL_TEXTURE_FILTER_CONTROL+ PointSprite -> GL_POINT_SPRITE -------------------------------------------------------------------------------- @@ -76,29 +76,29 @@ marshalTextureEnvParameter :: TextureEnvParameter -> GLenum marshalTextureEnvParameter x = case x of- TexEnvParamTextureEnvMode -> gl_TEXTURE_ENV_MODE- TexEnvParamTextureEnvColor -> gl_TEXTURE_ENV_COLOR- TexEnvParamCombineRGB -> gl_COMBINE_RGB- TexEnvParamCombineAlpha -> gl_COMBINE_ALPHA- TexEnvParamSrc0RGB -> gl_SRC0_RGB- TexEnvParamSrc1RGB -> gl_SRC1_RGB- TexEnvParamSrc2RGB -> gl_SRC2_RGB- TexEnvParamSrc3RGB -> gl_SOURCE3_RGB_NV- TexEnvParamSrc0Alpha -> gl_SRC0_ALPHA- TexEnvParamSrc1Alpha -> gl_SRC1_ALPHA- TexEnvParamSrc2Alpha -> gl_SRC2_ALPHA- TexEnvParamSrc3Alpha -> gl_SOURCE3_ALPHA_NV- TexEnvParamOperand0RGB -> gl_OPERAND0_RGB- TexEnvParamOperand1RGB -> gl_OPERAND1_RGB- TexEnvParamOperand2RGB -> gl_OPERAND2_RGB- TexEnvParamOperand3RGB -> gl_OPERAND3_RGB_NV- TexEnvParamOperand0Alpha -> gl_OPERAND0_ALPHA- TexEnvParamOperand1Alpha -> gl_OPERAND1_ALPHA- TexEnvParamOperand2Alpha -> gl_OPERAND2_ALPHA- TexEnvParamOperand3Alpha -> gl_OPERAND3_ALPHA_NV- TexEnvParamRGBScale -> gl_RGB_SCALE- TexEnvParamAlphaScale -> gl_ALPHA_SCALE- TexEnvParamLODBias -> gl_TEXTURE_LOD_BIAS+ TexEnvParamTextureEnvMode -> GL_TEXTURE_ENV_MODE+ TexEnvParamTextureEnvColor -> GL_TEXTURE_ENV_COLOR+ TexEnvParamCombineRGB -> GL_COMBINE_RGB+ TexEnvParamCombineAlpha -> GL_COMBINE_ALPHA+ TexEnvParamSrc0RGB -> GL_SRC0_RGB+ TexEnvParamSrc1RGB -> GL_SRC1_RGB+ TexEnvParamSrc2RGB -> GL_SRC2_RGB+ TexEnvParamSrc3RGB -> GL_SOURCE3_RGB_NV+ TexEnvParamSrc0Alpha -> GL_SRC0_ALPHA+ TexEnvParamSrc1Alpha -> GL_SRC1_ALPHA+ TexEnvParamSrc2Alpha -> GL_SRC2_ALPHA+ TexEnvParamSrc3Alpha -> GL_SOURCE3_ALPHA_NV+ TexEnvParamOperand0RGB -> GL_OPERAND0_RGB+ TexEnvParamOperand1RGB -> GL_OPERAND1_RGB+ TexEnvParamOperand2RGB -> GL_OPERAND2_RGB+ TexEnvParamOperand3RGB -> GL_OPERAND3_RGB_NV+ TexEnvParamOperand0Alpha -> GL_OPERAND0_ALPHA+ TexEnvParamOperand1Alpha -> GL_OPERAND1_ALPHA+ TexEnvParamOperand2Alpha -> GL_OPERAND2_ALPHA+ TexEnvParamOperand3Alpha -> GL_OPERAND3_ALPHA_NV+ TexEnvParamRGBScale -> GL_RGB_SCALE+ TexEnvParamAlphaScale -> GL_ALPHA_SCALE+ TexEnvParamLODBias -> GL_TEXTURE_LOD_BIAS -------------------------------------------------------------------------------- @@ -166,23 +166,23 @@ marshalTextureFunction :: TextureFunction -> GLint marshalTextureFunction x = fromIntegral $ case x of- Modulate -> gl_MODULATE- Decal -> gl_DECAL- Blend -> gl_BLEND- Replace -> gl_REPLACE- AddUnsigned -> gl_ADD- Combine -> gl_COMBINE- Combine4 -> gl_COMBINE4_NV+ Modulate -> GL_MODULATE+ Decal -> GL_DECAL+ Blend -> GL_BLEND+ Replace -> GL_REPLACE+ AddUnsigned -> GL_ADD+ Combine -> GL_COMBINE+ Combine4 -> GL_COMBINE4_NV unmarshalTextureFunction :: GLint -> TextureFunction unmarshalTextureFunction x- | y == gl_MODULATE = Modulate- | y == gl_DECAL = Decal- | y == gl_BLEND = Blend- | y == gl_REPLACE = Replace- | y == gl_ADD = AddUnsigned- | y == gl_COMBINE = Combine- | y == gl_COMBINE4_NV = Combine4+ | y == GL_MODULATE = Modulate+ | y == GL_DECAL = Decal+ | y == GL_BLEND = Blend+ | y == GL_REPLACE = Replace+ | y == GL_ADD = AddUnsigned+ | y == GL_COMBINE = Combine+ | y == GL_COMBINE4_NV = Combine4 | otherwise = error ("unmarshalTextureFunction: illegal value " ++ show x) where y = fromIntegral x @@ -207,25 +207,25 @@ marshalTextureCombineFunction :: TextureCombineFunction -> GLint marshalTextureCombineFunction x = fromIntegral $ case x of- Replace' -> gl_REPLACE- Modulate' -> gl_MODULATE- AddUnsigned' -> gl_ADD- AddSigned -> gl_ADD_SIGNED- Interpolate -> gl_INTERPOLATE- Subtract -> gl_SUBTRACT- Dot3RGB -> gl_DOT3_RGB- Dot3RGBA -> gl_DOT3_RGBA+ Replace' -> GL_REPLACE+ Modulate' -> GL_MODULATE+ AddUnsigned' -> GL_ADD+ AddSigned -> GL_ADD_SIGNED+ Interpolate -> GL_INTERPOLATE+ Subtract -> GL_SUBTRACT+ Dot3RGB -> GL_DOT3_RGB+ Dot3RGBA -> GL_DOT3_RGBA unmarshalTextureCombineFunction :: GLint -> TextureCombineFunction unmarshalTextureCombineFunction x- | y == gl_REPLACE = Replace'- | y == gl_MODULATE = Modulate'- | y == gl_ADD = AddUnsigned'- | y == gl_ADD_SIGNED = AddSigned- | y == gl_INTERPOLATE = Interpolate- | y == gl_SUBTRACT = Subtract- | y == gl_DOT3_RGB = Dot3RGB- | y == gl_DOT3_RGBA = Dot3RGBA+ | y == GL_REPLACE = Replace'+ | y == GL_MODULATE = Modulate'+ | y == GL_ADD = AddUnsigned'+ | y == GL_ADD_SIGNED = AddSigned+ | y == GL_INTERPOLATE = Interpolate+ | y == GL_SUBTRACT = Subtract+ | y == GL_DOT3_RGB = Dot3RGB+ | y == GL_DOT3_RGBA = Dot3RGBA | otherwise = error ("unmarshalTextureCombineFunction: illegal value " ++ show x) where y = fromIntegral x @@ -295,18 +295,18 @@ marshalSrc :: Src -> GLint marshalSrc x = fromIntegral $ case x of- CurrentUnit -> gl_TEXTURE- Previous -> gl_PREVIOUS+ CurrentUnit -> GL_TEXTURE+ Previous -> GL_PREVIOUS Crossbar u -> fromIntegral (marshalTextureUnit u)- Constant -> gl_CONSTANT- PrimaryColor -> gl_PRIMARY_COLOR+ Constant -> GL_CONSTANT+ PrimaryColor -> GL_PRIMARY_COLOR unmarshalSrc :: GLint -> Src unmarshalSrc x- | y == gl_TEXTURE = CurrentUnit- | y == gl_PREVIOUS = Previous- | y == gl_CONSTANT = Constant- | y == gl_PRIMARY_COLOR = PrimaryColor+ | y == GL_TEXTURE = CurrentUnit+ | y == GL_PREVIOUS = Previous+ | y == GL_CONSTANT = Constant+ | y == GL_PRIMARY_COLOR = PrimaryColor | otherwise = Crossbar (unmarshalTextureUnit (fromIntegral x)) where y = fromIntegral x @@ -320,7 +320,8 @@ arg :: TextureEnvParameter -> TextureEnvParameter -> StateVar Arg arg op src = combineArg (textureEnvOperand op) (textureEnvSrc src)- where combineArg v w = makeStateVar+ where combineArg :: StateVar BlendingFactor -> StateVar Src -> StateVar Arg+ combineArg v w = makeStateVar (liftM2 Arg (get v) (get w)) (\(Arg x y) -> do v $= x; w $= y)
src/Graphics/Rendering/OpenGL/GL/Texturing/Filter.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Filter--- Copyright : (c) Sven Panne 2013+-- Copyright : (c) Sven Panne 2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,7 +19,7 @@ MagnificationFilter, marshalMagnificationFilter, unmarshalMagnificationFilter ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -42,24 +42,24 @@ marshalMinificationFilter :: MinificationFilter -> GLint marshalMinificationFilter x = fromIntegral $ case x of- (Nearest, Nothing ) -> gl_NEAREST- (Linear', Nothing ) -> gl_LINEAR- (Nearest, Just Nearest) -> gl_NEAREST_MIPMAP_NEAREST- (Linear', Just Nearest) -> gl_LINEAR_MIPMAP_NEAREST- (Nearest, Just Linear') -> gl_NEAREST_MIPMAP_LINEAR- (Linear', Just Linear') -> gl_LINEAR_MIPMAP_LINEAR+ (Nearest, Nothing ) -> GL_NEAREST+ (Linear', Nothing ) -> GL_LINEAR+ (Nearest, Just Nearest) -> GL_NEAREST_MIPMAP_NEAREST+ (Linear', Just Nearest) -> GL_LINEAR_MIPMAP_NEAREST+ (Nearest, Just Linear') -> GL_NEAREST_MIPMAP_LINEAR+ (Linear', Just Linear') -> GL_LINEAR_MIPMAP_LINEAR marshalMagnificationFilter :: MagnificationFilter -> GLint marshalMagnificationFilter = marshalMinificationFilter . magToMin unmarshalMinificationFilter :: GLint -> MinificationFilter unmarshalMinificationFilter x- | y == gl_NEAREST = (Nearest, Nothing)- | y == gl_LINEAR = (Linear', Nothing)- | y == gl_NEAREST_MIPMAP_NEAREST = (Nearest, Just Nearest)- | y == gl_LINEAR_MIPMAP_NEAREST = (Linear', Just Nearest)- | y == gl_NEAREST_MIPMAP_LINEAR = (Nearest, Just Linear')- | y == gl_LINEAR_MIPMAP_LINEAR = (Linear', Just Linear')+ | y == GL_NEAREST = (Nearest, Nothing)+ | y == GL_LINEAR = (Linear', Nothing)+ | y == GL_NEAREST_MIPMAP_NEAREST = (Nearest, Just Nearest)+ | y == GL_LINEAR_MIPMAP_NEAREST = (Linear', Just Nearest)+ | y == GL_NEAREST_MIPMAP_LINEAR = (Nearest, Just Linear')+ | y == GL_LINEAR_MIPMAP_LINEAR = (Linear', Just Linear') | otherwise = error ("unmarshalMinificationFilter: illegal value " ++ show x) where y = fromIntegral x
src/Graphics/Rendering/OpenGL/GL/Texturing/Objects.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Objects--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,14 +22,14 @@ import Data.List import Data.Maybe (fromMaybe)+import Data.StateVar import Foreign.Marshal.Array import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.TexParameter import Graphics.Rendering.OpenGL.GL.Texturing.TextureObject import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Texturing/Parameters.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Parameters--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -24,18 +24,18 @@ ) where import Control.Monad+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.ComparisonFunction import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.Filter import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.Texturing.Specification import Graphics.Rendering.OpenGL.GL.Texturing.TexParameter import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -61,25 +61,25 @@ marshalTextureWrapMode :: (Repetition, Clamping) -> GLint marshalTextureWrapMode x = fromIntegral $ case x of- (Repeated, Clamp) -> gl_CLAMP- (Repeated, Repeat) -> gl_REPEAT- (Repeated, ClampToEdge) -> gl_CLAMP_TO_EDGE- (Repeated, ClampToBorder) -> gl_CLAMP_TO_BORDER- (Mirrored, Clamp) -> gl_MIRROR_CLAMP_EXT- (Mirrored, Repeat) -> gl_MIRRORED_REPEAT- (Mirrored, ClampToEdge) -> gl_MIRROR_CLAMP_TO_EDGE- (Mirrored, ClampToBorder) -> gl_MIRROR_CLAMP_TO_BORDER_EXT+ (Repeated, Clamp) -> GL_CLAMP+ (Repeated, Repeat) -> GL_REPEAT+ (Repeated, ClampToEdge) -> GL_CLAMP_TO_EDGE+ (Repeated, ClampToBorder) -> GL_CLAMP_TO_BORDER+ (Mirrored, Clamp) -> GL_MIRROR_CLAMP_EXT+ (Mirrored, Repeat) -> GL_MIRRORED_REPEAT+ (Mirrored, ClampToEdge) -> GL_MIRROR_CLAMP_TO_EDGE+ (Mirrored, ClampToBorder) -> GL_MIRROR_CLAMP_TO_BORDER_EXT unmarshalTextureWrapMode :: GLint -> (Repetition, Clamping) unmarshalTextureWrapMode x- | y == gl_CLAMP = (Repeated, Clamp)- | y == gl_REPEAT = (Repeated, Repeat)- | y == gl_CLAMP_TO_EDGE = (Repeated, ClampToEdge)- | y == gl_CLAMP_TO_BORDER = (Repeated, ClampToBorder)- | y == gl_MIRROR_CLAMP_EXT = (Mirrored, Clamp)- | y == gl_MIRRORED_REPEAT = (Mirrored, Repeat)- | y == gl_MIRROR_CLAMP_TO_EDGE = (Mirrored, ClampToEdge)- | y == gl_MIRROR_CLAMP_TO_BORDER_EXT = (Mirrored, ClampToBorder)+ | y == GL_CLAMP = (Repeated, Clamp)+ | y == GL_REPEAT = (Repeated, Repeat)+ | y == GL_CLAMP_TO_EDGE = (Repeated, ClampToEdge)+ | y == GL_CLAMP_TO_BORDER = (Repeated, ClampToBorder)+ | y == GL_MIRROR_CLAMP_EXT = (Mirrored, Clamp)+ | y == GL_MIRRORED_REPEAT = (Mirrored, Repeat)+ | y == GL_MIRROR_CLAMP_TO_EDGE = (Mirrored, ClampToEdge)+ | y == GL_MIRROR_CLAMP_TO_BORDER_EXT = (Mirrored, ClampToBorder) | otherwise = error ("unmarshalTextureWrapMode: illegal value " ++ show x) where y = fromIntegral x @@ -159,13 +159,13 @@ marshalTextureCompareMode :: Capability -> GLint marshalTextureCompareMode x = fromIntegral $ case x of- Disabled -> gl_NONE- Enabled -> gl_COMPARE_REF_TO_TEXTURE+ Disabled -> GL_NONE+ Enabled -> GL_COMPARE_REF_TO_TEXTURE unmarshalTextureCompareMode :: GLint -> Capability unmarshalTextureCompareMode x- | y == gl_NONE = Disabled- | y == gl_COMPARE_REF_TO_TEXTURE = Enabled+ | y == GL_NONE = Disabled+ | y == GL_COMPARE_REF_TO_TEXTURE = Enabled | otherwise = error ("unmarshalTextureCompareMode: illegal value " ++ show x) where y = fromIntegral x @@ -193,13 +193,13 @@ marshalTextureCompareOperator :: TextureCompareOperator -> GLenum marshalTextureCompareOperator x = case x of- LequalR -> gl_TEXTURE_LEQUAL_R_SGIX- GequalR -> gl_TEXTURE_GEQUAL_R_SGIX+ LequalR -> GL_TEXTURE_LEQUAL_R_SGIX+ GequalR -> GL_TEXTURE_GEQUAL_R_SGIX unmarshalTextureCompareOperator :: GLenum -> TextureCompareOperator unmarshalTextureCompareOperator x- | x == gl_TEXTURE_LEQUAL_R_SGIX = LequalR- | x == gl_TEXTURE_GEQUAL_R_SGIX = GequalR+ | x == GL_TEXTURE_LEQUAL_R_SGIX = LequalR+ | x == GL_TEXTURE_GEQUAL_R_SGIX = GequalR | otherwise = error ("unmarshalTextureCompareOperator: illegal value " ++ show x) --------------------------------------------------------------------------------@@ -212,8 +212,7 @@ -------------------------------------------------------------------------------- -combineTexParams :: ParameterizedTextureTarget t- => (t -> StateVar a)+combineTexParams :: (t -> StateVar a) -> (t -> StateVar b) -> (t -> StateVar (a,b)) combineTexParams v w t =@@ -221,8 +220,7 @@ (liftM2 (,) (get (v t)) (get (w t))) (\(x,y) -> do v t $= x; w t $= y) -combineTexParamsMaybe :: ParameterizedTextureTarget t- => (t -> StateVar Capability)+combineTexParamsMaybe :: (t -> StateVar Capability) -> (t -> StateVar a) -> (t -> StateVar (Maybe a)) combineTexParamsMaybe enab val t =
src/Graphics/Rendering/OpenGL/GL/Texturing/PixelInternalFormat.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ marshalPixelInternalFormat', unmarshalPixelInternalFormat, ) where -import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -133,120 +133,158 @@ | StencilIndex4 | StencilIndex8 | StencilIndex16+ | RGBS3TC+ | RGB4S3TC+ | RGBAS3TC+ | RGBA4S3TC+ | RGBADXT5S3TC+ | RGBA4DXT5S3TC+ | CompressedRGBAS3TCDXT1+ | CompressedRGBAS3TCDXT3+ | CompressedRGBAS3TCDXT5+ | CompressedRGBS3TCDXT1+ | Alpha32F+ | Intensity32F+ | Luminance32F+ | LuminanceAlpha32F+ | Alpha16F+ | Intensity16F+ | Luminance16F+ | LuminanceAlpha16F+ | Depth24Stencil8 deriving ( Eq, Ord, Show ) marshalPixelInternalFormat :: PixelInternalFormat -> GLint marshalPixelInternalFormat x = fromIntegral $ case x of- Alpha' -> gl_ALPHA- DepthComponent' -> gl_DEPTH_COMPONENT- Luminance' -> gl_LUMINANCE- LuminanceAlpha' -> gl_LUMINANCE_ALPHA- R8 -> gl_R8- R16 -> gl_R16- RG8 -> gl_RG8- RG16 -> gl_RG16- RGB' -> gl_RGB- RGBA' -> gl_RGBA- SRGB -> gl_SRGB- SRGBAlpha -> gl_SRGB_ALPHA- SLuminance -> gl_SLUMINANCE- SLuminanceAlpha -> gl_SLUMINANCE_ALPHA- Alpha4 -> gl_ALPHA4- Alpha8 -> gl_ALPHA8- Alpha12 -> gl_ALPHA12- Alpha16 -> gl_ALPHA16- DepthComponent16 -> gl_DEPTH_COMPONENT16- DepthComponent24 -> gl_DEPTH_COMPONENT24- DepthComponent32 -> gl_DEPTH_COMPONENT32- Luminance4 -> gl_LUMINANCE4- Luminance8 -> gl_LUMINANCE8- Luminance12 -> gl_LUMINANCE12- Luminance16 -> gl_LUMINANCE16- Luminance4Alpha4 -> gl_LUMINANCE4_ALPHA4- Luminance6Alpha2 -> gl_LUMINANCE6_ALPHA2- Luminance8Alpha8 -> gl_LUMINANCE8_ALPHA8- Luminance12Alpha4 -> gl_LUMINANCE12_ALPHA4- Luminance12Alpha12 -> gl_LUMINANCE12_ALPHA12- Luminance16Alpha16 -> gl_LUMINANCE16_ALPHA16- Intensity -> gl_INTENSITY- Intensity4 -> gl_INTENSITY4- Intensity8 -> gl_INTENSITY8- Intensity12 -> gl_INTENSITY12- Intensity16 -> gl_INTENSITY16- R3G3B2 -> gl_R3_G3_B2- RGB4 -> gl_RGB4- RGB5 -> gl_RGB5- RGB8 -> gl_RGB8- RGB10 -> gl_RGB10- RGB12 -> gl_RGB12- RGB16 -> gl_RGB16- RGBA2 -> gl_RGBA2- RGBA4 -> gl_RGBA4- RGB5A1 -> gl_RGB5_A1- RGBA8 -> gl_RGBA8- RGB10A2 -> gl_RGB10_A2- RGBA12 -> gl_RGBA12- RGBA16 -> gl_RGBA16- SRGB8 -> gl_SRGB8- SRGB8Alpha8 -> gl_SRGB8_ALPHA8- R16F -> gl_R16F- RG16F -> gl_RG16F- RGB16F -> gl_RGB16F- RGBA16F -> gl_RGBA16F- R32F -> gl_R32F- RG32F -> gl_RG32F- RGB32F -> gl_RGB32F- RGBA32F -> gl_RGBA32F- R8I -> gl_R8I- R8UI -> gl_R8UI- R16I -> gl_R16I- R16UI -> gl_R16UI- R32I -> gl_R32I- R32UI -> gl_R32UI- RG8I -> gl_RG8I- RG8UI -> gl_RG8UI- RG16I -> gl_RG16I- RG16UI -> gl_RG16UI- RG32I -> gl_R32I- RG32UI -> gl_R32UI- RGB8I -> gl_RGB8I- RGB8UI -> gl_RGB8UI- RGB16I -> gl_RGB16I- RGB16UI -> gl_RGB16UI- RGB32I -> gl_RGB32I- RGB32UI -> gl_RGB32UI- RGBA8I -> gl_RGBA8I- RGBA8UI -> gl_RGBA8UI- RGBA16I -> gl_RGBA16I- RGBA16UI -> gl_RGBA16UI- RGBA32I -> gl_RGBA32I- RGBA32UI -> gl_RGBA32UI- SLuminance8 -> gl_SLUMINANCE8- SLuminance8Alpha8 -> gl_SLUMINANCE8_ALPHA8- CompressedAlpha -> gl_COMPRESSED_ALPHA- CompressedLuminance -> gl_COMPRESSED_LUMINANCE- CompressedLuminanceAlpha -> gl_COMPRESSED_LUMINANCE_ALPHA- CompressedIntensity -> gl_COMPRESSED_INTENSITY- CompressedRed -> gl_COMPRESSED_RED- CompressedRG -> gl_COMPRESSED_RG- CompressedRGB -> gl_COMPRESSED_RGB- CompressedRGBA -> gl_COMPRESSED_RGBA- CompressedSRGB -> gl_COMPRESSED_SRGB- CompressedSRGBAlpha -> gl_COMPRESSED_SRGB_ALPHA- CompressedSLuminance -> gl_COMPRESSED_SLUMINANCE- CompressedSLuminanceAlpha -> gl_COMPRESSED_SLUMINANCE_ALPHA- CompressedRedRGTC1 -> gl_COMPRESSED_RED_RGTC1- CompressedSignedRedRGTC1 -> gl_COMPRESSED_SIGNED_RED_RGTC1- CompressedRG_RGTC2 -> gl_COMPRESSED_RG_RGTC2- CompressedSignedRG_RGTC2 -> gl_COMPRESSED_SIGNED_RG_RGTC2- DepthComponent32f -> gl_DEPTH_COMPONENT32F- Depth32fStencil8 -> gl_DEPTH32F_STENCIL8- RGB9E5 -> gl_RGB9_E5- R11fG11fB10f -> gl_R11F_G11F_B10F- StencilIndex1 -> gl_STENCIL_INDEX1- StencilIndex4 -> gl_STENCIL_INDEX4- StencilIndex8 -> gl_STENCIL_INDEX8- StencilIndex16 -> gl_STENCIL_INDEX16+ Alpha' -> GL_ALPHA+ DepthComponent' -> GL_DEPTH_COMPONENT+ Luminance' -> GL_LUMINANCE+ LuminanceAlpha' -> GL_LUMINANCE_ALPHA+ R8 -> GL_R8+ R16 -> GL_R16+ RG8 -> GL_RG8+ RG16 -> GL_RG16+ RGB' -> GL_RGB+ RGBA' -> GL_RGBA+ SRGB -> GL_SRGB+ SRGBAlpha -> GL_SRGB_ALPHA+ SLuminance -> GL_SLUMINANCE+ SLuminanceAlpha -> GL_SLUMINANCE_ALPHA+ Alpha4 -> GL_ALPHA4+ Alpha8 -> GL_ALPHA8+ Alpha12 -> GL_ALPHA12+ Alpha16 -> GL_ALPHA16+ DepthComponent16 -> GL_DEPTH_COMPONENT16+ DepthComponent24 -> GL_DEPTH_COMPONENT24+ DepthComponent32 -> GL_DEPTH_COMPONENT32+ Luminance4 -> GL_LUMINANCE4+ Luminance8 -> GL_LUMINANCE8+ Luminance12 -> GL_LUMINANCE12+ Luminance16 -> GL_LUMINANCE16+ Luminance4Alpha4 -> GL_LUMINANCE4_ALPHA4+ Luminance6Alpha2 -> GL_LUMINANCE6_ALPHA2+ Luminance8Alpha8 -> GL_LUMINANCE8_ALPHA8+ Luminance12Alpha4 -> GL_LUMINANCE12_ALPHA4+ Luminance12Alpha12 -> GL_LUMINANCE12_ALPHA12+ Luminance16Alpha16 -> GL_LUMINANCE16_ALPHA16+ Intensity -> GL_INTENSITY+ Intensity4 -> GL_INTENSITY4+ Intensity8 -> GL_INTENSITY8+ Intensity12 -> GL_INTENSITY12+ Intensity16 -> GL_INTENSITY16+ R3G3B2 -> GL_R3_G3_B2+ RGB4 -> GL_RGB4+ RGB5 -> GL_RGB5+ RGB8 -> GL_RGB8+ RGB10 -> GL_RGB10+ RGB12 -> GL_RGB12+ RGB16 -> GL_RGB16+ RGBA2 -> GL_RGBA2+ RGBA4 -> GL_RGBA4+ RGB5A1 -> GL_RGB5_A1+ RGBA8 -> GL_RGBA8+ RGB10A2 -> GL_RGB10_A2+ RGBA12 -> GL_RGBA12+ RGBA16 -> GL_RGBA16+ SRGB8 -> GL_SRGB8+ SRGB8Alpha8 -> GL_SRGB8_ALPHA8+ R16F -> GL_R16F+ RG16F -> GL_RG16F+ RGB16F -> GL_RGB16F+ RGBA16F -> GL_RGBA16F+ R32F -> GL_R32F+ RG32F -> GL_RG32F+ RGB32F -> GL_RGB32F+ RGBA32F -> GL_RGBA32F+ R8I -> GL_R8I+ R8UI -> GL_R8UI+ R16I -> GL_R16I+ R16UI -> GL_R16UI+ R32I -> GL_R32I+ R32UI -> GL_R32UI+ RG8I -> GL_RG8I+ RG8UI -> GL_RG8UI+ RG16I -> GL_RG16I+ RG16UI -> GL_RG16UI+ RG32I -> GL_R32I+ RG32UI -> GL_R32UI+ RGB8I -> GL_RGB8I+ RGB8UI -> GL_RGB8UI+ RGB16I -> GL_RGB16I+ RGB16UI -> GL_RGB16UI+ RGB32I -> GL_RGB32I+ RGB32UI -> GL_RGB32UI+ RGBA8I -> GL_RGBA8I+ RGBA8UI -> GL_RGBA8UI+ RGBA16I -> GL_RGBA16I+ RGBA16UI -> GL_RGBA16UI+ RGBA32I -> GL_RGBA32I+ RGBA32UI -> GL_RGBA32UI+ SLuminance8 -> GL_SLUMINANCE8+ SLuminance8Alpha8 -> GL_SLUMINANCE8_ALPHA8+ CompressedAlpha -> GL_COMPRESSED_ALPHA+ CompressedLuminance -> GL_COMPRESSED_LUMINANCE+ CompressedLuminanceAlpha -> GL_COMPRESSED_LUMINANCE_ALPHA+ CompressedIntensity -> GL_COMPRESSED_INTENSITY+ CompressedRed -> GL_COMPRESSED_RED+ CompressedRG -> GL_COMPRESSED_RG+ CompressedRGB -> GL_COMPRESSED_RGB+ CompressedRGBA -> GL_COMPRESSED_RGBA+ CompressedSRGB -> GL_COMPRESSED_SRGB+ CompressedSRGBAlpha -> GL_COMPRESSED_SRGB_ALPHA+ CompressedSLuminance -> GL_COMPRESSED_SLUMINANCE+ CompressedSLuminanceAlpha -> GL_COMPRESSED_SLUMINANCE_ALPHA+ CompressedRedRGTC1 -> GL_COMPRESSED_RED_RGTC1+ CompressedSignedRedRGTC1 -> GL_COMPRESSED_SIGNED_RED_RGTC1+ CompressedRG_RGTC2 -> GL_COMPRESSED_RG_RGTC2+ CompressedSignedRG_RGTC2 -> GL_COMPRESSED_SIGNED_RG_RGTC2+ DepthComponent32f -> GL_DEPTH_COMPONENT32F+ Depth32fStencil8 -> GL_DEPTH32F_STENCIL8+ RGB9E5 -> GL_RGB9_E5+ R11fG11fB10f -> GL_R11F_G11F_B10F+ StencilIndex1 -> GL_STENCIL_INDEX1+ StencilIndex4 -> GL_STENCIL_INDEX4+ StencilIndex8 -> GL_STENCIL_INDEX8+ StencilIndex16 -> GL_STENCIL_INDEX16+ RGBS3TC -> GL_RGB_S3TC+ RGB4S3TC -> GL_RGB4_S3TC+ RGBAS3TC -> GL_RGBA_S3TC+ RGBA4S3TC -> GL_RGBA4_S3TC+ RGBADXT5S3TC -> GL_RGBA_DXT5_S3TC+ RGBA4DXT5S3TC -> GL_RGBA4_DXT5_S3TC+ CompressedRGBAS3TCDXT1 -> GL_COMPRESSED_RGBA_S3TC_DXT1_EXT+ CompressedRGBAS3TCDXT3 -> GL_COMPRESSED_RGBA_S3TC_DXT3_EXT+ CompressedRGBAS3TCDXT5 -> GL_COMPRESSED_RGBA_S3TC_DXT5_EXT+ CompressedRGBS3TCDXT1 -> GL_COMPRESSED_RGB_S3TC_DXT1_EXT+ Alpha32F -> GL_ALPHA32F_ARB+ Intensity32F -> GL_INTENSITY32F_ARB+ Luminance32F -> GL_LUMINANCE32F_ARB+ LuminanceAlpha32F -> GL_LUMINANCE_ALPHA32F_ARB+ Alpha16F -> GL_ALPHA16F_ARB+ Intensity16F -> GL_INTENSITY16F_ARB+ Luminance16F -> GL_LUMINANCE16F_ARB+ LuminanceAlpha16F -> GL_LUMINANCE_ALPHA16F_ARB+ Depth24Stencil8 -> GL_DEPTH24_STENCIL8_EXT -- *sigh* The OpenGL API is sometimes a bit creative in its usage of types... marshalPixelInternalFormat' :: PixelInternalFormat -> GLenum@@ -254,111 +292,130 @@ unmarshalPixelInternalFormat :: GLint -> PixelInternalFormat unmarshalPixelInternalFormat x- | y == gl_ALPHA = Alpha'- | y == gl_DEPTH_COMPONENT = DepthComponent'- | y == gl_LUMINANCE = Luminance'- | y == gl_LUMINANCE_ALPHA = LuminanceAlpha'- | y == gl_RGB = RGB'- | y == gl_RGBA = RGBA'- | y == gl_SRGB = SRGB- | y == gl_SRGB_ALPHA = SRGBAlpha- | y == gl_SLUMINANCE = SLuminance- | y == gl_SLUMINANCE_ALPHA = SLuminanceAlpha- | y == gl_ALPHA4 = Alpha4- | y == gl_ALPHA8 = Alpha8- | y == gl_ALPHA12 = Alpha12- | y == gl_ALPHA16 = Alpha16- | y == gl_DEPTH_COMPONENT16 = DepthComponent16- | y == gl_DEPTH_COMPONENT24 = DepthComponent24- | y == gl_DEPTH_COMPONENT32 = DepthComponent32- | y == gl_LUMINANCE4 = Luminance4- | y == gl_LUMINANCE8 = Luminance8- | y == gl_LUMINANCE12 = Luminance12- | y == gl_LUMINANCE16 = Luminance16- | y == gl_LUMINANCE4_ALPHA4 = Luminance4Alpha4- | y == gl_LUMINANCE6_ALPHA2 = Luminance6Alpha2- | y == gl_LUMINANCE8_ALPHA8 = Luminance8Alpha8- | y == gl_LUMINANCE12_ALPHA4 = Luminance12Alpha4- | y == gl_LUMINANCE12_ALPHA12 = Luminance12Alpha12- | y == gl_LUMINANCE16_ALPHA16 = Luminance16Alpha16- | y == gl_INTENSITY = Intensity- | y == gl_INTENSITY4 = Intensity4- | y == gl_INTENSITY8 = Intensity8- | y == gl_INTENSITY12 = Intensity12- | y == gl_INTENSITY16 = Intensity16- | y == gl_R3_G3_B2 = R3G3B2- | y == gl_RGB4 = RGB4- | y == gl_RGB5 = RGB5- | y == gl_RGB8 = RGB8- | y == gl_RGB10 = RGB10- | y == gl_RGB12 = RGB12- | y == gl_RGB16 = RGB16- | y == gl_RGBA2 = RGBA2- | y == gl_RGBA4 = RGBA4- | y == gl_RGB5_A1 = RGB5A1- | y == gl_RGBA8 = RGBA8- | y == gl_RGB10_A2 = RGB10A2- | y == gl_RGBA12 = RGBA12- | y == gl_RGBA16 = RGBA16- | y == gl_SRGB8 = SRGB8- | y == gl_SRGB8_ALPHA8 = SRGB8Alpha8- | y == gl_R16F = R16F- | y == gl_RG16F = RG16F- | y == gl_RGB16F = RGB16F- | y == gl_RGBA16F = RGBA16F- | y == gl_R32F = R32F- | y == gl_RG32F = RG32F- | y == gl_RGB32F = RGB32F- | y == gl_RGBA32F = RGBA32F- | y == gl_R8I = R8I- | y == gl_R8UI = R8UI- | y == gl_R16I = R16I- | y == gl_R16UI = R16UI- | y == gl_R32I = R32I- | y == gl_R32UI = R32UI- | y == gl_RG8I = RG8I- | y == gl_RG8UI = RG8UI- | y == gl_RG16I = RG16I- | y == gl_RG16UI = RG16UI- | y == gl_R32I = RG32I- | y == gl_R32UI = RG32UI- | y == gl_RGB8I = RGB8I- | y == gl_RGB8UI = RGB8UI- | y == gl_RGB16I = RGB16I- | y == gl_RGB16UI = RGB16UI- | y == gl_RGB32I = RGB32I- | y == gl_RGB32UI = RGB32UI- | y == gl_RGBA8I = RGBA8I- | y == gl_RGBA8UI = RGBA8UI- | y == gl_RGBA16I = RGBA16I- | y == gl_RGBA16UI = RGBA16UI- | y == gl_RGBA32I = RGBA32I- | y == gl_RGBA32UI = RGBA32UI- | y == gl_SLUMINANCE8 = SLuminance8- | y == gl_SLUMINANCE8_ALPHA8 = SLuminance8Alpha8- | y == gl_COMPRESSED_ALPHA = CompressedAlpha- | y == gl_COMPRESSED_LUMINANCE = CompressedLuminance- | y == gl_COMPRESSED_LUMINANCE_ALPHA = CompressedLuminanceAlpha- | y == gl_COMPRESSED_INTENSITY = CompressedIntensity- | y == gl_COMPRESSED_RED = CompressedRed- | y == gl_COMPRESSED_RG = CompressedRG- | y == gl_COMPRESSED_RGB = CompressedRGB- | y == gl_COMPRESSED_RGBA = CompressedRGBA- | y == gl_COMPRESSED_SRGB = CompressedSRGB- | y == gl_COMPRESSED_SRGB_ALPHA = CompressedSRGBAlpha- | y == gl_COMPRESSED_SLUMINANCE = CompressedSLuminance- | y == gl_COMPRESSED_SLUMINANCE_ALPHA = CompressedSLuminanceAlpha- | y == gl_COMPRESSED_RED_RGTC1 = CompressedRedRGTC1- | y == gl_COMPRESSED_SIGNED_RED_RGTC1 = CompressedSignedRedRGTC1- | y == gl_COMPRESSED_RG_RGTC2 = CompressedRG_RGTC2- | y == gl_COMPRESSED_SIGNED_RG_RGTC2 = CompressedSignedRG_RGTC2- | y == gl_DEPTH_COMPONENT32F = DepthComponent32f- | y == gl_DEPTH32F_STENCIL8 = Depth32fStencil8- | y == gl_RGB9_E5 = RGB9E5- | y == gl_STENCIL_INDEX1 = StencilIndex1- | y == gl_STENCIL_INDEX4 = StencilIndex4- | y == gl_STENCIL_INDEX8 = StencilIndex8- | y == gl_STENCIL_INDEX16 = StencilIndex16+ | y == GL_ALPHA = Alpha'+ | y == GL_DEPTH_COMPONENT = DepthComponent'+ | y == GL_LUMINANCE = Luminance'+ | y == GL_LUMINANCE_ALPHA = LuminanceAlpha'+ | y == GL_RGB = RGB'+ | y == GL_RGBA = RGBA'+ | y == GL_SRGB = SRGB+ | y == GL_SRGB_ALPHA = SRGBAlpha+ | y == GL_SLUMINANCE = SLuminance+ | y == GL_SLUMINANCE_ALPHA = SLuminanceAlpha+ | y == GL_ALPHA4 = Alpha4+ | y == GL_ALPHA8 = Alpha8+ | y == GL_ALPHA12 = Alpha12+ | y == GL_ALPHA16 = Alpha16+ | y == GL_DEPTH_COMPONENT16 = DepthComponent16+ | y == GL_DEPTH_COMPONENT24 = DepthComponent24+ | y == GL_DEPTH_COMPONENT32 = DepthComponent32+ | y == GL_LUMINANCE4 = Luminance4+ | y == GL_LUMINANCE8 = Luminance8+ | y == GL_LUMINANCE12 = Luminance12+ | y == GL_LUMINANCE16 = Luminance16+ | y == GL_LUMINANCE4_ALPHA4 = Luminance4Alpha4+ | y == GL_LUMINANCE6_ALPHA2 = Luminance6Alpha2+ | y == GL_LUMINANCE8_ALPHA8 = Luminance8Alpha8+ | y == GL_LUMINANCE12_ALPHA4 = Luminance12Alpha4+ | y == GL_LUMINANCE12_ALPHA12 = Luminance12Alpha12+ | y == GL_LUMINANCE16_ALPHA16 = Luminance16Alpha16+ | y == GL_INTENSITY = Intensity+ | y == GL_INTENSITY4 = Intensity4+ | y == GL_INTENSITY8 = Intensity8+ | y == GL_INTENSITY12 = Intensity12+ | y == GL_INTENSITY16 = Intensity16+ | y == GL_R3_G3_B2 = R3G3B2+ | y == GL_RGB4 = RGB4+ | y == GL_RGB5 = RGB5+ | y == GL_RGB8 = RGB8+ | y == GL_RGB10 = RGB10+ | y == GL_RGB12 = RGB12+ | y == GL_RGB16 = RGB16+ | y == GL_RGBA2 = RGBA2+ | y == GL_RGBA4 = RGBA4+ | y == GL_RGB5_A1 = RGB5A1+ | y == GL_RGBA8 = RGBA8+ | y == GL_RGB10_A2 = RGB10A2+ | y == GL_RGBA12 = RGBA12+ | y == GL_RGBA16 = RGBA16+ | y == GL_SRGB8 = SRGB8+ | y == GL_SRGB8_ALPHA8 = SRGB8Alpha8+ | y == GL_R16F = R16F+ | y == GL_RG16F = RG16F+ | y == GL_RGB16F = RGB16F+ | y == GL_RGBA16F = RGBA16F+ | y == GL_R32F = R32F+ | y == GL_RG32F = RG32F+ | y == GL_RGB32F = RGB32F+ | y == GL_RGBA32F = RGBA32F+ | y == GL_R8I = R8I+ | y == GL_R8UI = R8UI+ | y == GL_R16I = R16I+ | y == GL_R16UI = R16UI+ | y == GL_R32I = R32I+ | y == GL_R32UI = R32UI+ | y == GL_RG8I = RG8I+ | y == GL_RG8UI = RG8UI+ | y == GL_RG16I = RG16I+ | y == GL_RG16UI = RG16UI+ | y == GL_R32I = RG32I+ | y == GL_R32UI = RG32UI+ | y == GL_RGB8I = RGB8I+ | y == GL_RGB8UI = RGB8UI+ | y == GL_RGB16I = RGB16I+ | y == GL_RGB16UI = RGB16UI+ | y == GL_RGB32I = RGB32I+ | y == GL_RGB32UI = RGB32UI+ | y == GL_RGBA8I = RGBA8I+ | y == GL_RGBA8UI = RGBA8UI+ | y == GL_RGBA16I = RGBA16I+ | y == GL_RGBA16UI = RGBA16UI+ | y == GL_RGBA32I = RGBA32I+ | y == GL_RGBA32UI = RGBA32UI+ | y == GL_SLUMINANCE8 = SLuminance8+ | y == GL_SLUMINANCE8_ALPHA8 = SLuminance8Alpha8+ | y == GL_COMPRESSED_ALPHA = CompressedAlpha+ | y == GL_COMPRESSED_LUMINANCE = CompressedLuminance+ | y == GL_COMPRESSED_LUMINANCE_ALPHA = CompressedLuminanceAlpha+ | y == GL_COMPRESSED_INTENSITY = CompressedIntensity+ | y == GL_COMPRESSED_RED = CompressedRed+ | y == GL_COMPRESSED_RG = CompressedRG+ | y == GL_COMPRESSED_RGB = CompressedRGB+ | y == GL_COMPRESSED_RGBA = CompressedRGBA+ | y == GL_COMPRESSED_SRGB = CompressedSRGB+ | y == GL_COMPRESSED_SRGB_ALPHA = CompressedSRGBAlpha+ | y == GL_COMPRESSED_SLUMINANCE = CompressedSLuminance+ | y == GL_COMPRESSED_SLUMINANCE_ALPHA = CompressedSLuminanceAlpha+ | y == GL_COMPRESSED_RED_RGTC1 = CompressedRedRGTC1+ | y == GL_COMPRESSED_SIGNED_RED_RGTC1 = CompressedSignedRedRGTC1+ | y == GL_COMPRESSED_RG_RGTC2 = CompressedRG_RGTC2+ | y == GL_COMPRESSED_SIGNED_RG_RGTC2 = CompressedSignedRG_RGTC2+ | y == GL_DEPTH_COMPONENT32F = DepthComponent32f+ | y == GL_DEPTH32F_STENCIL8 = Depth32fStencil8+ | y == GL_RGB9_E5 = RGB9E5+ | y == GL_STENCIL_INDEX1 = StencilIndex1+ | y == GL_STENCIL_INDEX4 = StencilIndex4+ | y == GL_STENCIL_INDEX8 = StencilIndex8+ | y == GL_STENCIL_INDEX16 = StencilIndex16+ | y == GL_RGB_S3TC = RGBS3TC+ | y == GL_RGB4_S3TC = RGB4S3TC+ | y == GL_RGBA_S3TC = RGBAS3TC+ | y == GL_RGBA4_S3TC = RGBA4S3TC+ | y == GL_RGBA_DXT5_S3TC = RGBADXT5S3TC+ | y == GL_RGBA4_DXT5_S3TC = RGBA4DXT5S3TC+ | y == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = CompressedRGBAS3TCDXT1+ | y == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = CompressedRGBAS3TCDXT3+ | y == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = CompressedRGBAS3TCDXT5+ | y == GL_COMPRESSED_RGB_S3TC_DXT1_EXT = CompressedRGBS3TCDXT1+ | y == GL_ALPHA32F_ARB = Alpha32F+ | y == GL_INTENSITY32F_ARB = Intensity32F+ | y == GL_LUMINANCE32F_ARB = Luminance32F+ | y == GL_LUMINANCE_ALPHA32F_ARB = LuminanceAlpha32F+ | y == GL_ALPHA16F_ARB = Alpha16F+ | y == GL_INTENSITY16F_ARB = Intensity16F+ | y == GL_LUMINANCE16F_ARB = Luminance16F+ | y == GL_LUMINANCE_ALPHA16F_ARB = LuminanceAlpha16F+ | y == GL_DEPTH24_STENCIL8_EXT = Depth24Stencil8 -- legacy values | y == 1 = Luminance' | y == 2 = LuminanceAlpha'
src/Graphics/Rendering/OpenGL/GL/Texturing/Queries.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Queries--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,20 +16,23 @@ TextureQuery, textureInternalFormat, textureSize1D, textureSize2D, textureSize3D, textureBorder, textureRGBASizes, textureSharedSize, textureIntensitySize, textureLuminanceSize, textureIndexSize,- textureDepthBits, textureCompressedImageSize, textureProxyOK+ textureDepthBits, textureCompressedImageSize, textureProxyOK,+ DataRepresentation(..), textureRGBATypes, textureIntensityType,+ textureLuminanceType, textureDepthType ) where import Control.Monad+import Data.StateVar import Foreign.Marshal.Utils+import Graphics.Rendering.OpenGL.GL.DataType import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.PixelRectangles-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.Texturing.Specification import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -50,25 +53,39 @@ | TextureCompressedImageSize | TextureCompressed | TextureSharedSize+ | TextureRedType+ | TextureGreenType+ | TextureBlueType+ | TextureAlphaType+ | TextureLuminanceType+ | TextureIntensityType+ | TextureDepthType marshalTexLevelParameter :: TexLevelParameter -> GLenum marshalTexLevelParameter x = case x of- TextureInternalFormat -> gl_TEXTURE_INTERNAL_FORMAT- TextureWidth -> gl_TEXTURE_WIDTH- TextureHeight -> gl_TEXTURE_HEIGHT- TextureDepth -> gl_TEXTURE_DEPTH- TextureBorder -> gl_TEXTURE_BORDER- TextureRedSize -> gl_TEXTURE_RED_SIZE- TextureGreenSize -> gl_TEXTURE_GREEN_SIZE- TextureBlueSize -> gl_TEXTURE_BLUE_SIZE- TextureAlphaSize -> gl_TEXTURE_ALPHA_SIZE- TextureIntensitySize -> gl_TEXTURE_INTENSITY_SIZE- TextureLuminanceSize -> gl_TEXTURE_LUMINANCE_SIZE- TextureIndexSize -> gl_TEXTURE_INDEX_SIZE_EXT- DepthBits -> gl_DEPTH_BITS- TextureCompressedImageSize -> gl_TEXTURE_COMPRESSED_IMAGE_SIZE- TextureCompressed -> gl_TEXTURE_COMPRESSED- TextureSharedSize -> gl_TEXTURE_SHARED_SIZE+ TextureInternalFormat -> GL_TEXTURE_INTERNAL_FORMAT+ TextureWidth -> GL_TEXTURE_WIDTH+ TextureHeight -> GL_TEXTURE_HEIGHT+ TextureDepth -> GL_TEXTURE_DEPTH+ TextureBorder -> GL_TEXTURE_BORDER+ TextureRedSize -> GL_TEXTURE_RED_SIZE+ TextureGreenSize -> GL_TEXTURE_GREEN_SIZE+ TextureBlueSize -> GL_TEXTURE_BLUE_SIZE+ TextureAlphaSize -> GL_TEXTURE_ALPHA_SIZE+ TextureIntensitySize -> GL_TEXTURE_INTENSITY_SIZE+ TextureLuminanceSize -> GL_TEXTURE_LUMINANCE_SIZE+ TextureIndexSize -> GL_TEXTURE_INDEX_SIZE_EXT+ DepthBits -> GL_DEPTH_BITS+ TextureCompressedImageSize -> GL_TEXTURE_COMPRESSED_IMAGE_SIZE+ TextureCompressed -> GL_TEXTURE_COMPRESSED+ TextureSharedSize -> GL_TEXTURE_SHARED_SIZE+ TextureRedType -> GL_TEXTURE_RED_TYPE_ARB+ TextureGreenType -> GL_TEXTURE_GREEN_TYPE_ARB+ TextureBlueType -> GL_TEXTURE_BLUE_TYPE_ARB+ TextureAlphaType -> GL_TEXTURE_ALPHA_TYPE_ARB+ TextureLuminanceType -> GL_TEXTURE_LUMINANCE_TYPE_ARB+ TextureIntensityType -> GL_TEXTURE_INTENSITY_TYPE_ARB+ TextureDepthType -> GL_TEXTURE_DEPTH_TYPE_ARB -------------------------------------------------------------------------------- @@ -151,6 +168,27 @@ textureProxyOK t level = makeGettableStateVar $ getTexLevelParameteri unmarshalGLboolean (marshalParameterizedTextureTargetProxy t) level TextureWidth++textureRGBATypes :: QueryableTextureTarget t => TextureQuery t (Color4 (Maybe DataRepresentation))+textureRGBATypes t level =+ makeGettableStateVar $+ liftM4 Color4+ (getDataRepr t level TextureRedType )+ (getDataRepr t level TextureGreenType)+ (getDataRepr t level TextureBlueType )+ (getDataRepr t level TextureAlphaType)++getDataRepr :: QueryableTextureTarget t => t -> Level -> TexLevelParameter -> IO (Maybe DataRepresentation)+getDataRepr = getTexLevelParameteriNoProxy (unmarshalDataRepresentation . fromIntegral)++textureIntensityType :: QueryableTextureTarget t => TextureQuery t (Maybe DataRepresentation)+textureIntensityType t level = makeGettableStateVar $ getDataRepr t level TextureIntensityType++textureLuminanceType :: QueryableTextureTarget t => TextureQuery t (Maybe DataRepresentation)+textureLuminanceType t level = makeGettableStateVar $ getDataRepr t level TextureLuminanceType++textureDepthType :: QueryableTextureTarget t => TextureQuery t (Maybe DataRepresentation)+textureDepthType t level = makeGettableStateVar $ getDataRepr t level TextureDepthType getTexLevelParameteriNoProxy :: QueryableTextureTarget t => (GLint -> a) -> t -> Level -> TexLevelParameter -> IO a getTexLevelParameteriNoProxy f = getTexLevelParameteri f . marshalQueryableTextureTarget
src/Graphics/Rendering/OpenGL/GL/Texturing/Specification.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.Specification--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -73,16 +73,16 @@ ) where import Foreign.Ptr+import Data.StateVar import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.PixelData import Graphics.Rendering.OpenGL.GL.PixelRectangles import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Texturing/TexParameter.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.TexParameter--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,15 +17,15 @@ TexParameter(..), texParami, texParamf, texParamC4f, getTexParameteri ) where +import Data.StateVar import Foreign.Marshal.Alloc import Foreign.Marshal.Utils import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.PeekPoke-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget import Graphics.Rendering.OpenGL.GL.VertexSpec-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -54,27 +54,27 @@ marshalTexParameter :: TexParameter -> GLenum marshalTexParameter x = case x of- TextureMinFilter -> gl_TEXTURE_MIN_FILTER- TextureMagFilter -> gl_TEXTURE_MAG_FILTER- TextureWrapS -> gl_TEXTURE_WRAP_S- TextureWrapT -> gl_TEXTURE_WRAP_T- TextureWrapR -> gl_TEXTURE_WRAP_R- TextureBorderColor -> gl_TEXTURE_BORDER_COLOR- TextureMinLOD -> gl_TEXTURE_MIN_LOD- TextureMaxLOD -> gl_TEXTURE_MAX_LOD- TextureBaseLevel -> gl_TEXTURE_BASE_LEVEL- TextureMaxLevel -> gl_TEXTURE_MAX_LEVEL- TexturePriority -> gl_TEXTURE_PRIORITY- TextureMaxAnisotropy -> gl_TEXTURE_MAX_ANISOTROPY_EXT- TextureCompare -> gl_TEXTURE_COMPARE_SGIX- TextureCompareOperator -> gl_TEXTURE_COMPARE_OPERATOR_SGIX- TextureCompareFailValue -> gl_TEXTURE_COMPARE_FAIL_VALUE_ARB- GenerateMipmap -> gl_GENERATE_MIPMAP- TextureCompareMode -> gl_TEXTURE_COMPARE_MODE- TextureCompareFunc -> gl_TEXTURE_COMPARE_FUNC- DepthTextureMode -> gl_DEPTH_TEXTURE_MODE- TextureLODBias -> gl_TEXTURE_LOD_BIAS- TextureResident -> gl_TEXTURE_RESIDENT+ TextureMinFilter -> GL_TEXTURE_MIN_FILTER+ TextureMagFilter -> GL_TEXTURE_MAG_FILTER+ TextureWrapS -> GL_TEXTURE_WRAP_S+ TextureWrapT -> GL_TEXTURE_WRAP_T+ TextureWrapR -> GL_TEXTURE_WRAP_R+ TextureBorderColor -> GL_TEXTURE_BORDER_COLOR+ TextureMinLOD -> GL_TEXTURE_MIN_LOD+ TextureMaxLOD -> GL_TEXTURE_MAX_LOD+ TextureBaseLevel -> GL_TEXTURE_BASE_LEVEL+ TextureMaxLevel -> GL_TEXTURE_MAX_LEVEL+ TexturePriority -> GL_TEXTURE_PRIORITY+ TextureMaxAnisotropy -> GL_TEXTURE_MAX_ANISOTROPY_EXT+ TextureCompare -> GL_TEXTURE_COMPARE_SGIX+ TextureCompareOperator -> GL_TEXTURE_COMPARE_OPERATOR_SGIX+ TextureCompareFailValue -> GL_TEXTURE_COMPARE_FAIL_VALUE_ARB+ GenerateMipmap -> GL_GENERATE_MIPMAP+ TextureCompareMode -> GL_TEXTURE_COMPARE_MODE+ TextureCompareFunc -> GL_TEXTURE_COMPARE_FUNC+ DepthTextureMode -> GL_DEPTH_TEXTURE_MODE+ TextureLODBias -> GL_TEXTURE_LOD_BIAS+ TextureResident -> GL_TEXTURE_RESIDENT --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/Texturing/TextureObject.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.TextureObject--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,10 +17,13 @@ TextureObject(..) ) where -import Foreign.Marshal.Array+import Control.Monad.IO.Class+import Data.ObjectName+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.Raw+import Graphics.Rendering.OpenGL.GL.QueryUtils+import Graphics.GL -------------------------------------------------------------------------------- @@ -30,14 +33,17 @@ -------------------------------------------------------------------------------- instance ObjectName TextureObject where- isObjectName = fmap unmarshalGLboolean . glIsTexture . textureID+ isObjectName = liftIO . fmap unmarshalGLboolean . glIsTexture . textureID deleteObjectNames textureObjects =- withArrayLen (map textureID textureObjects) $+ liftIO . withArrayLen (map textureID textureObjects) $ glDeleteTextures . fromIntegral instance GeneratableObjectName TextureObject where genObjectNames n =- allocaArray n $ \buf -> do+ liftIO . allocaArray n $ \buf -> do glGenTextures (fromIntegral n) buf fmap (map TextureObject) $ peekArray n buf++instance CanBeLabeled TextureObject where+ objectLabel = objectNameLabel GL_TEXTURE . textureID
src/Graphics/Rendering/OpenGL/GL/Texturing/TextureTarget.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -44,7 +44,7 @@ import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable import Graphics.Rendering.OpenGL.GL.QueryUtils.PName-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -84,9 +84,9 @@ instance ParameterizedTextureTarget TextureTarget1D where marshalParameterizedTextureTarget t = case t of- Texture1D -> gl_TEXTURE_1D+ Texture1D -> GL_TEXTURE_1D marshalParameterizedTextureTargetProxy t = case t of- Texture1D -> gl_PROXY_TEXTURE_1D+ Texture1D -> GL_PROXY_TEXTURE_1D marshalParameterizedTextureTargetEnableCap t = case t of Texture1D -> CapTexture1D @@ -118,13 +118,13 @@ instance ParameterizedTextureTarget TextureTarget2D where marshalParameterizedTextureTarget t = case t of- Texture2D -> gl_TEXTURE_2D- Texture1DArray -> gl_TEXTURE_1D_ARRAY- TextureRectangle -> gl_TEXTURE_RECTANGLE+ Texture2D -> GL_TEXTURE_2D+ Texture1DArray -> GL_TEXTURE_1D_ARRAY+ TextureRectangle -> GL_TEXTURE_RECTANGLE marshalParameterizedTextureTargetProxy t = case t of- Texture2D -> gl_PROXY_TEXTURE_2D- Texture1DArray -> gl_PROXY_TEXTURE_1D_ARRAY- TextureRectangle -> gl_PROXY_TEXTURE_RECTANGLE+ Texture2D -> GL_PROXY_TEXTURE_2D+ Texture1DArray -> GL_PROXY_TEXTURE_1D_ARRAY+ TextureRectangle -> GL_PROXY_TEXTURE_RECTANGLE marshalParameterizedTextureTargetEnableCap t = case t of Texture2D -> CapTexture2D Texture1DArray -> CapTexture1DArray@@ -153,9 +153,9 @@ instance ParameterizedTextureTarget TextureTarget2DMultisample where marshalParameterizedTextureTarget t = case t of- Texture2DMultisample -> gl_TEXTURE_2D_MULTISAMPLE+ Texture2DMultisample -> GL_TEXTURE_2D_MULTISAMPLE marshalParameterizedTextureTargetProxy t = case t of- Texture2DMultisample -> gl_PROXY_TEXTURE_2D_MULTISAMPLE+ Texture2DMultisample -> GL_PROXY_TEXTURE_2D_MULTISAMPLE marshalParameterizedTextureTargetEnableCap t = case t of Texture2DMultisample -> CapTexture2DMultisample @@ -174,9 +174,9 @@ instance ParameterizedTextureTarget TextureTargetCubeMap where marshalParameterizedTextureTarget t = case t of- TextureCubeMap -> gl_TEXTURE_CUBE_MAP+ TextureCubeMap -> GL_TEXTURE_CUBE_MAP marshalParameterizedTextureTargetProxy t = case t of- TextureCubeMap -> gl_PROXY_TEXTURE_CUBE_MAP+ TextureCubeMap -> GL_PROXY_TEXTURE_CUBE_MAP marshalParameterizedTextureTargetEnableCap t = case t of TextureCubeMap -> CapTextureCubeMap @@ -204,24 +204,24 @@ instance QueryableTextureTarget TextureTargetCubeMapFace where marshalQueryableTextureTarget t = case t of- TextureCubeMapPositiveX -> gl_TEXTURE_CUBE_MAP_POSITIVE_X- TextureCubeMapNegativeX -> gl_TEXTURE_CUBE_MAP_NEGATIVE_X- TextureCubeMapPositiveY -> gl_TEXTURE_CUBE_MAP_POSITIVE_Y- TextureCubeMapNegativeY -> gl_TEXTURE_CUBE_MAP_NEGATIVE_Y- TextureCubeMapPositiveZ -> gl_TEXTURE_CUBE_MAP_POSITIVE_Z- TextureCubeMapNegativeZ -> gl_TEXTURE_CUBE_MAP_NEGATIVE_Z+ TextureCubeMapPositiveX -> GL_TEXTURE_CUBE_MAP_POSITIVE_X+ TextureCubeMapNegativeX -> GL_TEXTURE_CUBE_MAP_NEGATIVE_X+ TextureCubeMapPositiveY -> GL_TEXTURE_CUBE_MAP_POSITIVE_Y+ TextureCubeMapNegativeY -> GL_TEXTURE_CUBE_MAP_NEGATIVE_Y+ TextureCubeMapPositiveZ -> GL_TEXTURE_CUBE_MAP_POSITIVE_Z+ TextureCubeMapNegativeZ -> GL_TEXTURE_CUBE_MAP_NEGATIVE_Z instance GettableTextureTarget TextureTargetCubeMapFace where marshalGettableTextureTarget = marshalQueryableTextureTarget unmarshalTextureTargetCubeMapFace :: GLenum -> TextureTargetCubeMapFace unmarshalTextureTargetCubeMapFace x- | x == gl_TEXTURE_CUBE_MAP_POSITIVE_X = TextureCubeMapPositiveX- | x == gl_TEXTURE_CUBE_MAP_NEGATIVE_X = TextureCubeMapNegativeX- | x == gl_TEXTURE_CUBE_MAP_POSITIVE_Y = TextureCubeMapPositiveY- | x == gl_TEXTURE_CUBE_MAP_NEGATIVE_Y = TextureCubeMapNegativeY- | x == gl_TEXTURE_CUBE_MAP_POSITIVE_Z = TextureCubeMapPositiveZ- | x == gl_TEXTURE_CUBE_MAP_NEGATIVE_Z = TextureCubeMapNegativeZ+ | x == GL_TEXTURE_CUBE_MAP_POSITIVE_X = TextureCubeMapPositiveX+ | x == GL_TEXTURE_CUBE_MAP_NEGATIVE_X = TextureCubeMapNegativeX+ | x == GL_TEXTURE_CUBE_MAP_POSITIVE_Y = TextureCubeMapPositiveY+ | x == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = TextureCubeMapNegativeY+ | x == GL_TEXTURE_CUBE_MAP_POSITIVE_Z = TextureCubeMapPositiveZ+ | x == GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = TextureCubeMapNegativeZ | otherwise = error $ "unmarshalTextureTargetCubeMapFace: unknown enum " ++ show x --------------------------------------------------------------------------------@@ -241,13 +241,13 @@ instance ParameterizedTextureTarget TextureTarget3D where marshalParameterizedTextureTarget t = case t of- Texture3D -> gl_TEXTURE_3D- Texture2DArray -> gl_TEXTURE_2D_ARRAY- TextureCubeMapArray -> gl_TEXTURE_CUBE_MAP_ARRAY+ Texture3D -> GL_TEXTURE_3D+ Texture2DArray -> GL_TEXTURE_2D_ARRAY+ TextureCubeMapArray -> GL_TEXTURE_CUBE_MAP_ARRAY marshalParameterizedTextureTargetProxy t = case t of- Texture3D -> gl_PROXY_TEXTURE_3D- Texture2DArray -> gl_PROXY_TEXTURE_2D_ARRAY- TextureCubeMapArray -> gl_PROXY_TEXTURE_CUBE_MAP_ARRAY+ Texture3D -> GL_PROXY_TEXTURE_3D+ Texture2DArray -> GL_PROXY_TEXTURE_2D_ARRAY+ TextureCubeMapArray -> GL_PROXY_TEXTURE_CUBE_MAP_ARRAY marshalParameterizedTextureTargetEnableCap t = case t of Texture3D -> CapTexture3D Texture2DArray -> CapTexture2DArray@@ -276,9 +276,9 @@ instance ParameterizedTextureTarget TextureTarget2DMultisampleArray where marshalParameterizedTextureTarget t = case t of- Texture2DMultisampleArray -> gl_TEXTURE_2D_MULTISAMPLE_ARRAY+ Texture2DMultisampleArray -> GL_TEXTURE_2D_MULTISAMPLE_ARRAY marshalParameterizedTextureTargetProxy t = case t of- Texture2DMultisampleArray -> gl_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY+ Texture2DMultisampleArray -> GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY marshalParameterizedTextureTargetEnableCap t = case t of Texture2DMultisampleArray -> CapTexture2DMultisampleArray @@ -292,6 +292,6 @@ instance BindableTextureTarget TextureTargetBuffer where marshalBindableTextureTarget t = case t of- TextureBuffer' -> gl_TEXTURE_BUFFER+ TextureBuffer' -> GL_TEXTURE_BUFFER marshalBindableTextureTargetPName1I t = case t of TextureBuffer' -> GetTextureBindingBuffer
src/Graphics/Rendering/OpenGL/GL/Texturing/TextureUnit.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -19,7 +19,7 @@ import Foreign.Ptr import Foreign.Storable-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -44,7 +44,7 @@ marshalTextureUnit :: TextureUnit -> GLenum-marshalTextureUnit (TextureUnit x) = gl_TEXTURE0 + fromIntegral x+marshalTextureUnit (TextureUnit x) = GL_TEXTURE0 + fromIntegral x unmarshalTextureUnit :: GLenum -> TextureUnit-unmarshalTextureUnit x = TextureUnit (fromIntegral (x - gl_TEXTURE0))+unmarshalTextureUnit x = TextureUnit (fromIntegral (x - GL_TEXTURE0))
src/Graphics/Rendering/OpenGL/GL/TransformFeedback.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.TransformFeedback--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -29,6 +29,7 @@ maxTransformFeedbackSeparateComponents ) where +import Data.StateVar import Foreign.Marshal.Array import Graphics.Rendering.OpenGL.GL.ByteString import Graphics.Rendering.OpenGL.GL.DataType@@ -37,8 +38,7 @@ import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GL.Shaders.Program import Graphics.Rendering.OpenGL.GL.Shaders.Variables-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -52,18 +52,21 @@ data TransformFeedbackBufferMode = InterleavedAttribs+ | SeparateAttribs | SeperateAttribs deriving ( Eq, Ord, Show )+{-# DEPRECATED SeperateAttribs "Use 'SeparateAttribs' instead." #-} marshalTransformFeedbackBufferMode :: TransformFeedbackBufferMode -> GLenum marshalTransformFeedbackBufferMode x = case x of- InterleavedAttribs -> gl_INTERLEAVED_ATTRIBS- SeperateAttribs -> gl_SEPARATE_ATTRIBS+ InterleavedAttribs -> GL_INTERLEAVED_ATTRIBS+ SeparateAttribs -> GL_SEPARATE_ATTRIBS+ SeperateAttribs -> GL_SEPARATE_ATTRIBS unmarshalTransformFeedbackBufferMode :: GLenum -> TransformFeedbackBufferMode unmarshalTransformFeedbackBufferMode x- | x == gl_INTERLEAVED_ATTRIBS = InterleavedAttribs- | x == gl_SEPARATE_ATTRIBS = SeperateAttribs+ | x == GL_INTERLEAVED_ATTRIBS = InterleavedAttribs+ | x == GL_SEPARATE_ATTRIBS = SeparateAttribs | otherwise = error $ "unmarshalTransformFeedbackBufferMode: illegal value " ++ show x -- limits
src/Graphics/Rendering/OpenGL/GL/VertexArrayObjects.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.VertexArrayObjects--- Copyright : (c) Sven Panne, Lars Corbijn 2011-2013+-- Copyright : (c) Sven Panne 2011-2019, Lars Corbijn 2011-2016 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,13 +15,14 @@ bindVertexArrayObject ) where -import Foreign.Marshal.Array-+import Control.Monad.IO.Class+import Data.ObjectName+import Data.StateVar+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Graphics.Rendering.OpenGL.GL.DebugOutput import Graphics.Rendering.OpenGL.GL.GLboolean-import Graphics.Rendering.OpenGL.GL.ObjectName import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL ----------------------------------------------------------------------------- @@ -29,16 +30,20 @@ deriving( Eq, Ord, Show ) instance ObjectName VertexArrayObject where- isObjectName = fmap unmarshalGLboolean . glIsVertexArray . vertexArrayID+ isObjectName =+ liftIO . fmap unmarshalGLboolean . glIsVertexArray . vertexArrayID deleteObjectNames bufferObjects =- withArrayLen (map vertexArrayID bufferObjects) $+ liftIO . withArrayLen (map vertexArrayID bufferObjects) $ glDeleteVertexArrays . fromIntegral instance GeneratableObjectName VertexArrayObject where- genObjectNames n = allocaArray n $ \buf -> do+ genObjectNames n = liftIO . allocaArray n $ \buf -> do glGenVertexArrays (fromIntegral n) buf fmap (map VertexArrayObject) $ peekArray n buf++instance CanBeLabeled VertexArrayObject where+ objectLabel = objectNameLabel GL_VERTEX_ARRAY . vertexArrayID bindVertexArrayObject :: StateVar (Maybe VertexArrayObject) bindVertexArrayObject = makeStateVar getVAO bindVAO
src/Graphics/Rendering/OpenGL/GL/VertexArrays.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.VertexArrays--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -26,15 +26,28 @@ clientState, clientActiveTexture, -- * Dereferencing and Rendering- ArrayIndex, NumArrayIndices, NumIndexBlocks,- arrayElement, drawArrays, multiDrawArrays, drawElements, multiDrawElements,- drawRangeElements, maxElementsVertices, maxElementsIndices, lockArrays,+ ArrayIndex, NumArrayIndices, NumIndexBlocks, NumInstances,+ BaseInstance, BaseVertex,+ arrayElement,++ drawArrays, drawArraysInstancedBaseInstance, drawArraysInstanced,+ multiDrawArrays,++ drawElements, drawElementsInstancedBaseInstance, drawElementsInstanced,+ multiDrawElements, drawRangeElements,++ drawElementsBaseVertex, drawRangeElementsBaseVertex,+ drawElementsInstancedBaseVertex, drawElementsInstancedBaseVertexBaseInstance,+ multiDrawElementsBaseVertex,++ maxElementsVertices, maxElementsIndices, lockArrays, primitiveRestartIndex, primitiveRestartIndexNV, -- * Generic Vertex Attribute Arrays vertexAttribPointer, vertexAttribArray, ) where +import Data.StateVar import Foreign.Ptr ( Ptr, nullPtr ) import Graphics.Rendering.OpenGL.GL.Capability import Graphics.Rendering.OpenGL.GL.DataType@@ -42,11 +55,10 @@ import Graphics.Rendering.OpenGL.GL.PrimitiveMode import Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -77,15 +89,15 @@ marshalClientArrayType :: ClientArrayType -> GLenum marshalClientArrayType x = case x of- VertexArray -> gl_VERTEX_ARRAY- NormalArray -> gl_NORMAL_ARRAY- ColorArray -> gl_COLOR_ARRAY- IndexArray -> gl_INDEX_ARRAY- TextureCoordArray -> gl_TEXTURE_COORD_ARRAY- EdgeFlagArray -> gl_EDGE_FLAG_ARRAY- FogCoordArray -> gl_FOG_COORD_ARRAY- SecondaryColorArray -> gl_SECONDARY_COLOR_ARRAY- MatrixIndexArray -> gl_MATRIX_INDEX_ARRAY_ARB+ VertexArray -> GL_VERTEX_ARRAY+ NormalArray -> GL_NORMAL_ARRAY+ ColorArray -> GL_COLOR_ARRAY+ IndexArray -> GL_INDEX_ARRAY+ TextureCoordArray -> GL_TEXTURE_COORD_ARRAY+ EdgeFlagArray -> GL_EDGE_FLAG_ARRAY+ FogCoordArray -> GL_FOG_COORD_ARRAY+ SecondaryColorArray -> GL_SECONDARY_COLOR_ARRAY+ MatrixIndexArray -> GL_MATRIX_INDEX_ARRAY_ARB -- Hmmm... clientArrayTypeToEnableCap :: ClientArrayType -> EnableCap@@ -273,20 +285,20 @@ marshalInterleavedArrays :: InterleavedArrays -> GLenum marshalInterleavedArrays x = case x of- V2f -> gl_V2F- V3f -> gl_V3F- C4ubV2f -> gl_C4UB_V2F- C4ubV3f -> gl_C4UB_V3F- C3fV3f -> gl_C3F_V3F- N3fV3f -> gl_N3F_V3F- C4fN3fV3f -> gl_C4F_N3F_V3F- T2fV3f -> gl_T2F_V3F- T4fV4f -> gl_T4F_V4F- T2fC4ubV3f -> gl_T2F_C4UB_V3F- T2fC3fV3f -> gl_T2F_C3F_V3F- T2fN3fV3f -> gl_T2F_N3F_V3F- T2fC4fN3fV3f -> gl_T2F_C4F_N3F_V3F- T4fC4fN3fV4f -> gl_T4F_C4F_N3F_V4F+ V2f -> GL_V2F+ V3f -> GL_V3F+ C4ubV2f -> GL_C4UB_V2F+ C4ubV3f -> GL_C4UB_V3F+ C3fV3f -> GL_C3F_V3F+ N3fV3f -> GL_N3F_V3F+ C4fN3fV3f -> GL_C4F_N3F_V3F+ T2fV3f -> GL_T2F_V3F+ T4fV4f -> GL_T4F_V4F+ T2fC4ubV3f -> GL_T2F_C4UB_V3F+ T2fC3fV3f -> GL_T2F_C3F_V3F+ T2fN3fV3f -> GL_T2F_N3F_V3F+ T2fC4fN3fV3f -> GL_T2F_C4F_N3F_V3F+ T4fC4fN3fV4f -> GL_T4F_C4F_N3F_V4F -------------------------------------------------------------------------------- @@ -322,6 +334,16 @@ type NumIndexBlocks = GLsizei +type NumInstances = GLsizei++type BaseInstance = GLuint++type BaseVertex = GLint++-- TODO: The ranges (ArrayIndex, ArrayIndex) below should actually use GLuint:+-- type RangeStart = GLuint+-- type RangeEnd = GLuint+ -------------------------------------------------------------------------------- arrayElement :: ArrayIndex -> IO ()@@ -330,27 +352,45 @@ drawArrays :: PrimitiveMode -> ArrayIndex -> NumArrayIndices -> IO () drawArrays = glDrawArrays . marshalPrimitiveMode -multiDrawArrays ::- PrimitiveMode -> Ptr ArrayIndex -> Ptr NumArrayIndices -> NumIndexBlocks- -> IO ()+drawArraysInstancedBaseInstance :: PrimitiveMode -> ArrayIndex -> NumArrayIndices -> NumInstances -> BaseInstance -> IO ()+drawArraysInstancedBaseInstance = glDrawArraysInstancedBaseInstance . marshalPrimitiveMode++drawArraysInstanced :: PrimitiveMode -> ArrayIndex -> NumArrayIndices -> NumInstances -> IO ()+drawArraysInstanced = glDrawArraysInstanced . marshalPrimitiveMode++multiDrawArrays :: PrimitiveMode -> Ptr ArrayIndex -> Ptr NumArrayIndices -> NumIndexBlocks -> IO () multiDrawArrays = glMultiDrawArrays . marshalPrimitiveMode drawElements :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> IO () drawElements m c = glDrawElements (marshalPrimitiveMode m) c . marshalDataType -multiDrawElements ::- PrimitiveMode -> Ptr NumArrayIndices -> DataType -> Ptr (Ptr a)- -> NumIndexBlocks -> IO ()-multiDrawElements m c =- glMultiDrawElements (marshalPrimitiveMode m) c . marshalDataType+drawElementsInstancedBaseInstance :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> NumInstances -> BaseInstance -> IO ()+drawElementsInstancedBaseInstance m c = glDrawElementsInstancedBaseInstance (marshalPrimitiveMode m) c . marshalDataType -drawRangeElements ::- PrimitiveMode -> (ArrayIndex, ArrayIndex) -> NumArrayIndices -> DataType- -> Ptr a -> IO ()-drawRangeElements m (s, e) c =- glDrawRangeElements (marshalPrimitiveMode m) (fromIntegral s)- (fromIntegral e) c . marshalDataType+drawElementsInstanced :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> NumInstances -> IO ()+drawElementsInstanced m c = glDrawElementsInstanced (marshalPrimitiveMode m) c . marshalDataType +multiDrawElements :: PrimitiveMode -> Ptr NumArrayIndices -> DataType -> Ptr (Ptr a) -> NumIndexBlocks -> IO ()+multiDrawElements m c = glMultiDrawElements (marshalPrimitiveMode m) c . marshalDataType++drawRangeElements :: PrimitiveMode -> (ArrayIndex, ArrayIndex) -> NumArrayIndices -> DataType -> Ptr a -> IO ()+drawRangeElements m (s, e) c = glDrawRangeElements (marshalPrimitiveMode m) (fromIntegral s) (fromIntegral e) c . marshalDataType++drawElementsBaseVertex :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> BaseVertex -> IO ()+drawElementsBaseVertex m c = glDrawElementsBaseVertex (marshalPrimitiveMode m) c . marshalDataType++drawRangeElementsBaseVertex :: PrimitiveMode -> (ArrayIndex, ArrayIndex) -> NumArrayIndices -> DataType -> Ptr a -> BaseVertex -> IO ()+drawRangeElementsBaseVertex m (s, e) c = glDrawRangeElementsBaseVertex (marshalPrimitiveMode m) (fromIntegral s) (fromIntegral e) c . marshalDataType++drawElementsInstancedBaseVertex :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> NumInstances -> BaseVertex -> IO ()+drawElementsInstancedBaseVertex m c = glDrawElementsInstancedBaseVertex (marshalPrimitiveMode m) c . marshalDataType++drawElementsInstancedBaseVertexBaseInstance :: PrimitiveMode -> NumArrayIndices -> DataType -> Ptr a -> NumInstances -> BaseVertex -> BaseInstance -> IO ()+drawElementsInstancedBaseVertexBaseInstance m c = glDrawElementsInstancedBaseVertexBaseInstance (marshalPrimitiveMode m) c . marshalDataType++multiDrawElementsBaseVertex :: PrimitiveMode -> Ptr NumArrayIndices -> DataType -> Ptr (Ptr a) -> NumIndexBlocks -> Ptr BaseVertex -> IO ()+multiDrawElementsBaseVertex m c = glMultiDrawElementsBaseVertex (marshalPrimitiveMode m) c . marshalDataType+ maxElementsVertices :: GettableStateVar NumArrayIndices maxElementsVertices = makeGettableStateVar (getSizei1 id GetMaxElementsVertices) @@ -399,8 +439,8 @@ setPrimitiveRestartIndexNV :: Maybe ArrayIndex -> IO () setPrimitiveRestartIndexNV maybeIdx = case maybeIdx of- Nothing -> glDisableClientState gl_PRIMITIVE_RESTART_NV- Just idx -> do glEnableClientState gl_PRIMITIVE_RESTART_NV+ Nothing -> glDisableClientState GL_PRIMITIVE_RESTART_NV+ Just idx -> do glEnableClientState GL_PRIMITIVE_RESTART_NV glPrimitiveRestartIndexNV (fromIntegral idx) --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GL/VertexAttributes.hs view
@@ -1,9 +1,9 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveDataTypeable, CPP #-} {-# OPTIONS_HADDOCK hide #-} -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.VertexAttributes--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,7 +22,9 @@ Index1(..) ) where -import Control.Applicative+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ( Applicative(..) )+#endif import Control.Monad import Data.Foldable import Data.Ix
src/Graphics/Rendering/OpenGL/GL/VertexSpec.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GL.VertexSpec--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -58,17 +58,17 @@ TextureUnit(..), maxTextureUnit ) where +import Data.StateVar import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.PeekPoke import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.Texturing.TextureUnit import Graphics.Rendering.OpenGL.GL.VertexAttributes-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GLU.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Graphics/Rendering/OpenGL/GLU/Errors.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Errors--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,7 @@ Error(..), ErrorCategory(..), errors ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Data.StateVar import Graphics.Rendering.OpenGL.GLU.ErrorsInternal --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenGL/GLU/ErrorsInternal.hs view
@@ -1,10 +1,10 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-cse #-}- {-# OPTIONS_HADDOCK hide #-} -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.ErrorsInternal--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,10 +22,8 @@ ) where import Data.IORef ( IORef, newIORef, readIORef, writeIORef )-import Foreign.C.String ( peekCString )-import Foreign.Ptr ( castPtr )-import Graphics.Rendering.GLU.Raw-import Graphics.Rendering.OpenGL.Raw+import Graphics.GLU+import Graphics.GL import System.IO.Unsafe ( unsafePerformIO ) --------------------------------------------------------------------------------@@ -36,12 +34,11 @@ data Error = Error ErrorCategory String deriving ( Eq, Ord, Show ) ---------------------------------------------------------------------------------- -- | General GL\/GLU error categories data ErrorCategory- = InvalidEnum+ = ContextLost+ | InvalidEnum | InvalidValue | InvalidOperation | InvalidFramebufferOperation@@ -53,61 +50,130 @@ | NURBSError deriving ( Eq, Ord, Show ) -unmarshalErrorCategory :: GLenum -> ErrorCategory-unmarshalErrorCategory c- | isInvalidEnum c = InvalidEnum- | isInvalidValue c = InvalidValue- | isInvalidOperation c = InvalidOperation- | isInvalidFramebufferOperation c = InvalidFramebufferOperation- | isOutOfMemory c = OutOfMemory- | isStackOverflow c = StackOverflow- | isStackUnderflow c = StackUnderflow- | isTableTooLarge c = TableTooLarge- | isTesselatorError c = TesselatorError- | isNURBSError c = NURBSError- | otherwise = error "unmarshalErrorCategory"--isInvalidEnum :: GLenum -> Bool-isInvalidEnum c = c == gl_INVALID_ENUM || c == glu_INVALID_ENUM--isInvalidValue :: GLenum -> Bool-isInvalidValue c = c == gl_INVALID_VALUE || c == glu_INVALID_VALUE--isInvalidOperation :: GLenum -> Bool-isInvalidOperation c = c == gl_INVALID_OPERATION || c == glu_INVALID_OPERATION--isInvalidFramebufferOperation :: GLenum -> Bool-isInvalidFramebufferOperation c = c == gl_INVALID_FRAMEBUFFER_OPERATION--isOutOfMemory :: GLenum -> Bool-isOutOfMemory c = c == gl_OUT_OF_MEMORY || c == glu_OUT_OF_MEMORY--isStackOverflow :: GLenum -> Bool-isStackOverflow c = c == gl_STACK_OVERFLOW--isStackUnderflow :: GLenum -> Bool-isStackUnderflow c = c == gl_STACK_UNDERFLOW--isTableTooLarge :: GLenum -> Bool-isTableTooLarge c = c == gl_TABLE_TOO_LARGE--isTesselatorError :: GLenum -> Bool-isTesselatorError c = glu_TESS_ERROR1 <= c && c <= glu_TESS_ERROR8--isNURBSError :: GLenum -> Bool-isNURBSError c = glu_NURBS_ERROR1 <= c && c <= glu_NURBS_ERROR37-------------------------------------------------------------------------------------- The returned error string is statically allocated, so peekCString--- does the right thing here. No malloc/free necessary here.--makeError :: GLenum -> IO Error-makeError e = do- let category = unmarshalErrorCategory e- ptr <- gluErrorString e- description <- peekCString (castPtr ptr)- return $ Error category description+makeError :: GLenum -> Error+makeError c+ -- GL errors+ | c == GL_CONTEXT_LOST =+ Error ContextLost "context lost"+ | c == GL_INVALID_ENUM =+ Error InvalidEnum "invalid enumerant"+ | c == GL_INVALID_VALUE =+ Error InvalidValue "invalid value"+ | c == GL_INVALID_OPERATION =+ Error InvalidOperation "invalid operation"+ | c == GL_INVALID_FRAMEBUFFER_OPERATION =+ Error InvalidFramebufferOperation "invalid framebuffer operation"+ | c == GL_OUT_OF_MEMORY+ = Error OutOfMemory "out of memory"+ | c == GL_STACK_OVERFLOW =+ Error StackOverflow "stack overflow"+ | c == GL_STACK_UNDERFLOW =+ Error StackUnderflow "stack underflow"+ | c == GL_TABLE_TOO_LARGE =+ Error TableTooLarge "table too large"+ -- GLU errors+ | c == GLU_INVALID_ENUM =+ Error InvalidEnum "invalid enumerant"+ | c == GLU_INVALID_VALUE =+ Error InvalidValue "invalid value"+ | c == GLU_INVALID_OPERATION =+ Error InvalidOperation "invalid operation"+ | c == GLU_OUT_OF_MEMORY+ = Error OutOfMemory "out of memory"+ -- GLU tesselator error+ | c == GLU_TESS_ERROR1 =+ Error TesselatorError "gluTessBeginPolygon() must precede a gluTessEndPolygon()"+ | c == GLU_TESS_ERROR2 =+ Error TesselatorError "gluTessBeginContour() must precede a gluTessEndContour()"+ | c == GLU_TESS_ERROR3 =+ Error TesselatorError "gluTessEndPolygon() must follow a gluTessBeginPolygon()"+ | c == GLU_TESS_ERROR4 =+ Error TesselatorError "gluTessEndContour() must follow a gluTessBeginContour()"+ | c == GLU_TESS_ERROR5 =+ Error TesselatorError "a coordinate is too large"+ | c == GLU_TESS_ERROR6 =+ Error TesselatorError "need combine callback"+ | c == GLU_TESS_ERROR7 =+ Error TesselatorError "tesselation error 7"+ | c == GLU_TESS_ERROR8 =+ Error TesselatorError "tesselation error 8"+ -- GLU NUBRS errors+ | c == GLU_NURBS_ERROR1 =+ Error NURBSError "spline order un-supported"+ | c == GLU_NURBS_ERROR2 =+ Error NURBSError "too few knots"+ | c == GLU_NURBS_ERROR3 =+ Error NURBSError "valid knot range is empty"+ | c == GLU_NURBS_ERROR4 =+ Error NURBSError "decreasing knot sequence knot"+ | c == GLU_NURBS_ERROR5 =+ Error NURBSError "knot multiplicity greater than order of spline"+ | c == GLU_NURBS_ERROR6 =+ Error NURBSError "gluEndCurve() must follow gluBeginCurve()"+ | c == GLU_NURBS_ERROR7 =+ Error NURBSError "gluBeginCurve() must precede gluEndCurve()"+ | c == GLU_NURBS_ERROR8 =+ Error NURBSError "missing or extra geometric data"+ | c == GLU_NURBS_ERROR9 =+ Error NURBSError "can't draw piecewise linear trimming curves"+ | c == GLU_NURBS_ERROR10 =+ Error NURBSError "missing or extra domain data"+ | c == GLU_NURBS_ERROR11 =+ Error NURBSError "missing or extra domain data"+ | c == GLU_NURBS_ERROR12 =+ Error NURBSError "gluEndTrim() must precede gluEndSurface()"+ | c == GLU_NURBS_ERROR13 =+ Error NURBSError "gluBeginSurface() must precede gluEndSurface()"+ | c == GLU_NURBS_ERROR14 =+ Error NURBSError "curve of improper type passed as trim curve"+ | c == GLU_NURBS_ERROR15 =+ Error NURBSError "gluBeginSurface() must precede gluBeginTrim()"+ | c == GLU_NURBS_ERROR16 =+ Error NURBSError "gluEndTrim() must follow gluBeginTrim()"+ | c == GLU_NURBS_ERROR17 =+ Error NURBSError "gluBeginTrim() must precede gluEndTrim()"+ | c == GLU_NURBS_ERROR18 =+ Error NURBSError "invalid or missing trim curve"+ | c == GLU_NURBS_ERROR19 =+ Error NURBSError "gluBeginTrim() must precede gluPwlCurve()"+ | c == GLU_NURBS_ERROR20 =+ Error NURBSError "piecewise linear trimming curve referenced twice"+ | c == GLU_NURBS_ERROR21 =+ Error NURBSError "piecewise linear trimming curve and nurbs curve mixed"+ | c == GLU_NURBS_ERROR22 =+ Error NURBSError "improper usage of trim data type"+ | c == GLU_NURBS_ERROR23 =+ Error NURBSError "nurbs curve referenced twice"+ | c == GLU_NURBS_ERROR24 =+ Error NURBSError "nurbs curve and piecewise linear trimming curve mixed"+ | c == GLU_NURBS_ERROR25 =+ Error NURBSError "nurbs surface referenced twice"+ | c == GLU_NURBS_ERROR26 =+ Error NURBSError "invalid property"+ | c == GLU_NURBS_ERROR27 =+ Error NURBSError "gluEndSurface() must follow gluBeginSurface()"+ | c == GLU_NURBS_ERROR28 =+ Error NURBSError "intersecting or misoriented trim curves"+ | c == GLU_NURBS_ERROR29 =+ Error NURBSError "intersecting trim curves"+ | c == GLU_NURBS_ERROR30 =+ Error NURBSError "UNUSED"+ | c == GLU_NURBS_ERROR31 =+ Error NURBSError "unconnected trim curves"+ | c == GLU_NURBS_ERROR32 =+ Error NURBSError "unknown knot error"+ | c == GLU_NURBS_ERROR33 =+ Error NURBSError "negative vertex count encountered"+ | c == GLU_NURBS_ERROR34 =+ Error NURBSError "negative byte-stride encounteed"+ | c == GLU_NURBS_ERROR35 =+ Error NURBSError "unknown type descriptor"+ | c == GLU_NURBS_ERROR36 =+ Error NURBSError "null control point reference"+ | c == GLU_NURBS_ERROR37 =+ Error NURBSError "duplicate point on piecewise linear trimming curve"+ -- Something went terribly wrong...+ | otherwise = error "makeError" -------------------------------------------------------------------------------- @@ -136,14 +202,12 @@ else return $ reverse acc isError :: GLenum -> Bool-isError = (/= gl_NO_ERROR)+isError = (/= GL_NO_ERROR) -------------------------------------------------------------------------------- getErrors :: IO [Error]-getErrors = do- es <- getErrorCodesAux (const ([], True))- mapM makeError es+getErrors = map makeError `fmap` getErrorCodesAux (const ([], True)) recordErrorCode :: GLenum -> IO () recordErrorCode e = do@@ -152,13 +216,13 @@ return () recordInvalidEnum :: IO ()-recordInvalidEnum = recordErrorCode gl_INVALID_ENUM+recordInvalidEnum = recordErrorCode GL_INVALID_ENUM recordInvalidValue :: IO ()-recordInvalidValue = recordErrorCode gl_INVALID_VALUE+recordInvalidValue = recordErrorCode GL_INVALID_VALUE recordOutOfMemory :: IO ()-recordOutOfMemory = recordErrorCode gl_OUT_OF_MEMORY+recordOutOfMemory = recordErrorCode GL_OUT_OF_MEMORY -- ToDo: Make this thread-safe getErrorCodesAux :: ([GLenum] -> ([GLenum],Bool)) -> IO [GLenum]
src/Graphics/Rendering/OpenGL/GLU/Initialization.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Initialization--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,21 +16,18 @@ gluVersion, gluExtensions ) where -import Foreign.C.String-import Foreign.Ptr-import Graphics.Rendering.GLU.Raw-import Graphics.Rendering.OpenGL.GL.QueryUtils-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.Raw+import Data.StateVar+import Graphics.GLU+import Graphics.Rendering.OpenGL.GL.ByteString+import Graphics.GL -------------------------------------------------------------------------------- gluVersion :: GettableStateVar String-gluVersion = makeGettableStateVar (getString glu_VERSION)+gluVersion = makeGettableStateVar (getString GLU_VERSION) gluExtensions :: GettableStateVar [String]-gluExtensions = makeGettableStateVar (fmap words $ getString glu_EXTENSIONS)+gluExtensions = makeGettableStateVar (fmap words $ getString GLU_EXTENSIONS) getString :: GLenum -> IO String-getString n = gluGetString n >>=- maybeNullPtr (return "") (peekCString . castPtr)+getString = getStringWith . gluGetString
src/Graphics/Rendering/OpenGL/GLU/Matrix.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Matrix--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -21,12 +21,12 @@ import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable-import Graphics.Rendering.GLU.Raw+import Graphics.GLU import Graphics.Rendering.OpenGL.GL.CoordTrans import Graphics.Rendering.OpenGL.GL.GLboolean import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- -- matrix setup
src/Graphics/Rendering/OpenGL/GLU/Mipmapping.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Mipmapping--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -16,13 +16,13 @@ scaleImage, build1DMipmaps, build2DMipmaps ) where -import Graphics.Rendering.GLU.Raw+import Graphics.GLU import Graphics.Rendering.OpenGL.GL.CoordTrans ( Size(..) ) import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat import Graphics.Rendering.OpenGL.GL.PixelData ( PixelData, withPixelData ) import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget import Graphics.Rendering.OpenGL.GLU.ErrorsInternal ( recordInvalidValue )-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- -- Section 3.1 (Image Scaling)
src/Graphics/Rendering/OpenGL/GLU/NURBS.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.NURBS--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -34,7 +34,7 @@ import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable-import Graphics.Rendering.GLU.Raw hiding (+import Graphics.GLU hiding ( NURBSBeginCallback, NURBSVertexCallback, NURBSNormalCallback, NURBSColorCallback, NURBSEndCallback ) import Graphics.Rendering.OpenGL.GL.Tensor@@ -47,7 +47,7 @@ import Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- -- chapter 7.1: The NURBS Object@@ -79,7 +79,7 @@ withNURBSBeginCallback nurbsObj beginCallback action = bracket (makeNURBSBeginCallback (beginCallback . unmarshalPrimitiveMode)) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_BEGIN callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_BEGIN callbackPtr action --------------------------------------------------------------------------------@@ -91,7 +91,7 @@ withNURBSVertexCallback nurbsObj vertexCallback action = bracket (makeNURBSVertexCallback (\p -> peek (castPtr p) >>= vertexCallback)) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_VERTEX callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_VERTEX callbackPtr action --------------------------------------------------------------------------------@@ -103,7 +103,7 @@ withNURBSNormalCallback nurbsObj normalCallback action = bracket (makeNURBSNormalCallback (\p -> peek (castPtr p) >>= normalCallback)) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_NORMAL callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_NORMAL callbackPtr action --------------------------------------------------------------------------------@@ -115,7 +115,7 @@ withNURBSColorCallback nurbsObj colorCallback action = bracket (makeNURBSColorCallback (\p -> peek (castPtr p) >>= colorCallback)) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_COLOR callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_COLOR callbackPtr action --------------------------------------------------------------------------------@@ -127,7 +127,7 @@ withNURBSEndCallback nurbsObj endCallback action = bracket (makeNURBSEndCallback endCallback) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_END callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_END callbackPtr action --------------------------------------------------------------------------------@@ -139,7 +139,7 @@ withErrorCallback nurbsObj errorCallback action = bracket (makeNURBSErrorCallback errorCallback) freeHaskellFunPtr $ \callbackPtr -> do- gluNurbsCallback nurbsObj glu_NURBS_ERROR callbackPtr+ gluNurbsCallback nurbsObj GLU_NURBS_ERROR callbackPtr action checkForNURBSError :: NURBSObj -> IO a -> IO a@@ -179,10 +179,10 @@ trimmingTarget :: p GLfloat -> GLenum instance TrimmingPoint Vertex2 where- trimmingTarget = const glu_MAP1_TRIM_2+ trimmingTarget = const GLU_MAP1_TRIM_2 instance TrimmingPoint Vertex3 where- trimmingTarget = const glu_MAP1_TRIM_3+ trimmingTarget = const GLU_MAP1_TRIM_3 nurbsBeginEndTrim :: NURBSObj -> IO a -> IO a nurbsBeginEndTrim nurbsObj =@@ -205,16 +205,16 @@ marshalNURBSMode :: NURBSMode -> GLfloat marshalNURBSMode x = fromIntegral $ case x of- NURBSTessellator -> glu_NURBS_TESSELLATOR- NURBSRenderer -> glu_NURBS_RENDERER+ NURBSTessellator -> GLU_NURBS_TESSELLATOR+ NURBSRenderer -> GLU_NURBS_RENDERER setNURBSMode :: NURBSObj -> NURBSMode -> IO ()-setNURBSMode nurbsObj = gluNurbsProperty nurbsObj glu_NURBS_MODE . marshalNURBSMode+setNURBSMode nurbsObj = gluNurbsProperty nurbsObj GLU_NURBS_MODE . marshalNURBSMode -------------------------------------------------------------------------------- setNURBSCulling :: NURBSObj -> Capability -> IO ()-setNURBSCulling nurbsObj = gluNurbsProperty nurbsObj glu_CULLING . fromIntegral . marshalCapability+setNURBSCulling nurbsObj = gluNurbsProperty nurbsObj GLU_CULLING . fromIntegral . marshalCapability -------------------------------------------------------------------------------- @@ -227,14 +227,14 @@ marshalSamplingMethod' :: SamplingMethod' -> GLfloat marshalSamplingMethod' x = fromIntegral $ case x of- PathLength' -> glu_PATH_LENGTH- ParametricError' -> glu_PARAMETRIC_TOLERANCE- DomainDistance' -> glu_DOMAIN_DISTANCE- ObjectPathLength' -> glu_OBJECT_PATH_LENGTH- ObjectParametricError' -> glu_OBJECT_PARAMETRIC_ERROR+ PathLength' -> GLU_PATH_LENGTH+ ParametricError' -> GLU_PARAMETRIC_TOLERANCE+ DomainDistance' -> GLU_DOMAIN_DISTANCE+ ObjectPathLength' -> GLU_OBJECT_PATH_LENGTH+ ObjectParametricError' -> GLU_OBJECT_PARAMETRIC_ERROR setSamplingMethod' :: NURBSObj -> SamplingMethod' -> IO ()-setSamplingMethod' nurbsObj = gluNurbsProperty nurbsObj glu_SAMPLING_METHOD . marshalSamplingMethod'+setSamplingMethod' nurbsObj = gluNurbsProperty nurbsObj GLU_SAMPLING_METHOD . marshalSamplingMethod' -------------------------------------------------------------------------------- @@ -249,26 +249,26 @@ setSamplingMethod :: NURBSObj -> SamplingMethod -> IO () setSamplingMethod nurbsObj x = case x of PathLength s -> do- gluNurbsProperty nurbsObj glu_SAMPLING_TOLERANCE s+ gluNurbsProperty nurbsObj GLU_SAMPLING_TOLERANCE s setSamplingMethod' nurbsObj PathLength' ParametricError p -> do- gluNurbsProperty nurbsObj glu_PARAMETRIC_TOLERANCE p+ gluNurbsProperty nurbsObj GLU_PARAMETRIC_TOLERANCE p setSamplingMethod' nurbsObj ParametricError' DomainDistance u v -> do- gluNurbsProperty nurbsObj glu_U_STEP u- gluNurbsProperty nurbsObj glu_V_STEP v+ gluNurbsProperty nurbsObj GLU_U_STEP u+ gluNurbsProperty nurbsObj GLU_V_STEP v setSamplingMethod' nurbsObj DomainDistance' ObjectPathLength s -> do- gluNurbsProperty nurbsObj glu_SAMPLING_TOLERANCE s+ gluNurbsProperty nurbsObj GLU_SAMPLING_TOLERANCE s setSamplingMethod' nurbsObj ObjectPathLength' ObjectParametricError p -> do- gluNurbsProperty nurbsObj glu_PARAMETRIC_TOLERANCE p+ gluNurbsProperty nurbsObj GLU_PARAMETRIC_TOLERANCE p setSamplingMethod' nurbsObj ObjectParametricError' -------------------------------------------------------------------------------- setAutoLoadMatrix :: NURBSObj -> Bool -> IO ()-setAutoLoadMatrix nurbsObj = gluNurbsProperty nurbsObj glu_AUTO_LOAD_MATRIX . marshalGLboolean+setAutoLoadMatrix nurbsObj = gluNurbsProperty nurbsObj GLU_AUTO_LOAD_MATRIX . marshalGLboolean loadSamplingMatrices :: (Matrix m1, Matrix m2) => NURBSObj -> Maybe (m1 GLfloat, m2 GLfloat, (Position, Size)) -> IO () loadSamplingMatrices nurbsObj =@@ -303,9 +303,9 @@ marshalDisplayMode' :: DisplayMode' -> GLfloat marshalDisplayMode' x = fromIntegral $ case x of- Fill' -> glu_FILL- OutlinePolygon -> glu_OUTLINE_POLYGON- OutlinePatch -> glu_OUTLINE_PATCH+ Fill' -> GLU_FILL+ OutlinePolygon -> GLU_OUTLINE_POLYGON+ OutlinePatch -> GLU_OUTLINE_PATCH setDisplayMode' :: NURBSObj -> DisplayMode' -> IO ()-setDisplayMode' nurbsObj = gluNurbsProperty nurbsObj glu_DISPLAY_MODE . marshalDisplayMode'+setDisplayMode' nurbsObj = gluNurbsProperty nurbsObj GLU_DISPLAY_MODE . marshalDisplayMode'
src/Graphics/Rendering/OpenGL/GLU/Quadrics.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Quadrics--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -21,13 +21,13 @@ import Control.Monad ( unless ) import Foreign.Ptr ( Ptr, nullPtr, freeHaskellFunPtr )-import Graphics.Rendering.GLU.Raw+import Graphics.GLU import Graphics.Rendering.OpenGL.GL.Colors ( ShadingModel(Smooth,Flat) ) import Graphics.Rendering.OpenGL.GL.Exception ( bracket ) import Graphics.Rendering.OpenGL.GL.GLboolean ( marshalGLboolean ) import Graphics.Rendering.OpenGL.GLU.ErrorsInternal ( recordErrorCode, recordOutOfMemory )-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -40,19 +40,19 @@ marshalQuadricDrawStyle :: QuadricDrawStyle -> GLenum marshalQuadricDrawStyle x = case x of- PointStyle -> glu_POINT- LineStyle -> glu_LINE- FillStyle -> glu_FILL- SilhouetteStyle -> glu_SILHOUETTE+ PointStyle -> GLU_POINT+ LineStyle -> GLU_LINE+ FillStyle -> GLU_FILL+ SilhouetteStyle -> GLU_SILHOUETTE -------------------------------------------------------------------------------- type QuadricNormal = Maybe ShadingModel marshalQuadricNormal :: QuadricNormal -> GLenum-marshalQuadricNormal (Just Smooth) = glu_SMOOTH-marshalQuadricNormal (Just Flat ) = glu_FLAT-marshalQuadricNormal Nothing = glu_NONE+marshalQuadricNormal (Just Smooth) = GLU_SMOOTH+marshalQuadricNormal (Just Flat ) = GLU_FLAT+marshalQuadricNormal Nothing = GLU_NONE -------------------------------------------------------------------------------- @@ -63,8 +63,8 @@ marshalQuadricOrientation :: QuadricOrientation -> GLenum marshalQuadricOrientation x = case x of- Outside -> glu_OUTSIDE- Inside -> glu_INSIDE+ Outside -> GLU_OUTSIDE+ Inside -> GLU_INSIDE -------------------------------------------------------------------------------- @@ -127,7 +127,7 @@ withErrorCallback :: QuadricObj -> QuadricCallback -> IO a -> IO a withErrorCallback quadricObj callback action = bracket (makeQuadricCallback callback) freeHaskellFunPtr $ \callbackPtr -> do- gluQuadricCallback quadricObj glu_ERROR callbackPtr+ gluQuadricCallback quadricObj GLU_ERROR callbackPtr action setStyle :: QuadricObj -> QuadricStyle -> IO ()
src/Graphics/Rendering/OpenGL/GLU/Tessellation.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.GLU.Tessellation--- Copyright : (c) Sven Panne 2002-2013+-- Copyright : (c) Sven Panne 2002-2019 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -43,7 +43,7 @@ import Foreign.Marshal.Pool ( Pool, withPool, pooledNew ) import Foreign.Ptr ( Ptr, nullPtr, plusPtr, castPtr, freeHaskellFunPtr ) import Foreign.Storable ( Storable(..) )-import Graphics.Rendering.GLU.Raw+import Graphics.GLU import Graphics.Rendering.OpenGL.GL.Tensor import Graphics.Rendering.OpenGL.GL.EdgeFlag ( unmarshalEdgeFlag ) import Graphics.Rendering.OpenGL.GL.Exception ( bracket )@@ -54,7 +54,7 @@ import Graphics.Rendering.OpenGL.GL.VertexSpec import Graphics.Rendering.OpenGL.GL.QueryUtils import Graphics.Rendering.OpenGL.GLU.ErrorsInternal-import Graphics.Rendering.OpenGL.Raw+import Graphics.GL -------------------------------------------------------------------------------- @@ -68,11 +68,11 @@ marshalTessWinding :: TessWinding -> GLenum marshalTessWinding x = case x of- TessWindingOdd -> glu_TESS_WINDING_ODD- TessWindingNonzero -> glu_TESS_WINDING_NONZERO- TessWindingPositive -> glu_TESS_WINDING_POSITIVE- TessWindingNegative -> glu_TESS_WINDING_NEGATIVE- TessWindingAbsGeqTwo -> glu_TESS_WINDING_ABS_GEQ_TWO+ TessWindingOdd -> GLU_TESS_WINDING_ODD+ TessWindingNonzero -> GLU_TESS_WINDING_NONZERO+ TessWindingPositive -> GLU_TESS_WINDING_POSITIVE+ TessWindingNegative -> GLU_TESS_WINDING_NEGATIVE+ TessWindingAbsGeqTwo -> GLU_TESS_WINDING_ABS_GEQ_TWO -------------------------------------------------------------------------------- @@ -397,7 +397,7 @@ withBeginCallback tessObj beginCallback action = bracket (makeTessBeginCallback (beginCallback . unmarshalPrimitiveMode)) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_BEGIN callbackPtr+ gluTessCallback tessObj GLU_TESS_BEGIN callbackPtr action --------------------------------------------------------------------------------@@ -409,7 +409,7 @@ withEdgeFlagCallback tessObj edgeFlagCallback action = bracket (makeTessEdgeFlagCallback (edgeFlagCallback . unmarshalEdgeFlag)) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_EDGE_FLAG callbackPtr+ gluTessCallback tessObj GLU_TESS_EDGE_FLAG callbackPtr action --------------------------------------------------------------------------------@@ -422,7 +422,7 @@ withVertexCallback tessObj vertexCallback action = bracket (makeTessVertexCallback (\p -> peek p >>= vertexCallback)) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_VERTEX callbackPtr+ gluTessCallback tessObj GLU_TESS_VERTEX callbackPtr action --------------------------------------------------------------------------------@@ -433,7 +433,7 @@ withEndCallback :: TessellatorObj -> EndCallback -> IO a -> IO a withEndCallback tessObj endCallback action = bracket (makeTessEndCallback endCallback) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_END callbackPtr+ gluTessCallback tessObj GLU_TESS_END callbackPtr action --------------------------------------------------------------------------------@@ -445,7 +445,7 @@ withErrorCallback tessObj errorCallback action = bracket (makeTessErrorCallback errorCallback) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_ERROR callbackPtr+ gluTessCallback tessObj GLU_TESS_ERROR callbackPtr action checkForError :: TessellatorObj -> IO a -> IO a@@ -467,7 +467,7 @@ withPool $ \vertexPool -> bracket (makeTessCombineCallback (combineProperties vertexPool combiner)) freeHaskellFunPtr $ \callbackPtr -> do- gluTessCallback tessObj glu_TESS_COMBINE callbackPtr+ gluTessCallback tessObj GLU_TESS_COMBINE callbackPtr action -- NOTE: SGI's tesselator has a bug, sometimes passing NULL for the last two@@ -508,14 +508,14 @@ setWindingRule :: TessellatorObj -> TessWinding -> IO () setWindingRule tessObj =- gluTessProperty tessObj glu_TESS_WINDING_RULE . fromIntegral . marshalTessWinding+ gluTessProperty tessObj GLU_TESS_WINDING_RULE . fromIntegral . marshalTessWinding setBoundaryOnly :: TessellatorObj -> Bool -> IO () setBoundaryOnly tessObj =- gluTessProperty tessObj glu_TESS_BOUNDARY_ONLY . marshalGLboolean+ gluTessProperty tessObj GLU_TESS_BOUNDARY_ONLY . marshalGLboolean setTolerance :: TessellatorObj -> Tolerance -> IO ()-setTolerance tessObj = gluTessProperty tessObj glu_TESS_TOLERANCE+setTolerance tessObj = gluTessProperty tessObj GLU_TESS_TOLERANCE setNormal :: TessellatorObj -> Normal3 GLdouble -> IO () setNormal tessObj (Normal3 x y z) = gluTessNormal tessObj x y z