haskell-opengl / OpenGL

Haskell bindings to OpenGL
http://www.haskell.org/haskellwiki/OpenGL
BSD 3-Clause "New" or "Revised" License
147 stars 26 forks source link

PolygonMode in Polygons.hs does not conform to OpenGL specification #21

Closed jcmartin closed 11 years ago

jcmartin commented 12 years ago

In Polygons.hs, polygonMode's type signature is:

polygonMode :: StateVar (PolygonMode, PolygonMode)

However, in all documentation from 1.5 and above in the OpenGL the prototype for the PolygonMode function is:

void PolygonMode(enum Face, enum Mode);

The correct type signature for polygonMode should be then:

polygonMode :: StateVar (Face, PolygonMode)
svenpanne commented 11 years ago

Actually, the signature is OK: The POLYGON_MODE state of OpenGL is a pair of polygon modes, one mode for the FRONT, one for the BACK, see e.g. the state tables in the OpenGL spec ('type 2 x E'). This is probably more obvious when retrieving this part of the OpenGL state:

(frontMode, backMode) <- get polygonMode

So actually some documentation is lacking, while the code is correct.

One issue regarding polygonMode remains: Separate polygon modes are deprecated nowadays (see e.g. section D.2 of the OpenGL 4.3 spec), so polygonMode should handle this properly. I'll open a new issue for this.