[HOpenGL] Specialized versions of renderPrimitives?
Bas van Dijk
basvandijk at home.nl
Thu Oct 26 18:04:14 EDT 2006
On Thursday 26 October 2006 18:39, Henning Thielemann wrote:
> It would be more concise and safer to write
> lineLoop [v1, v2, v3, v4]
> lines [(v1, v2), (v3, v4)]
If I understand the following correctly:
http://www.haskell.org/ghc/dist/current/docs/libraries/OpenGL/Graphics-Rendering-OpenGL-GL-BeginEnd.html#v%3ArenderPrimitive
With renderPrimitive you can also add additional properties per vertex. Like:
renderPrimitive LineLoop $ do
color c1
texCoord t1
vertex v1
color c2
texCoord t2
vertex v2
color c3
texCoord t3
vertex v3
color c4
texCoord t4
vertex v4
It would be possible to do it in a type safe manner by having a data type
Vertex that has a list of VertexProperties:
type Vertex = [VertexProperty]
data VertexProperty = Coordinate ...
| Color ...
| TextureCoordinate ...
...
then you can have something like:
v1, v2, v3, v4 :: Vertex
lineLoop [v1, v2, v3, v4]
Regards,
Bas van Dijk
More information about the HOpenGL
mailing list