在Haskell OpenGL中透明度无法正常工作

时间:2018-11-29 17:05:24

标签: haskell opengl

我已经使用Haskell OpenGL完成了此多面体:

enter image description here

多面体的侧面是透明的:

renderPrimitive Quads $ do
  materialDiffuse Front $= col
  ......

其中col是一种颜色,其“ a”成分等于0.2

main函数中,启用了混合:

blend $= Enabled
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)

可以看到两边确实是透明的。但是,多面体的边缘不会出现在内部。为什么?我尝试了许多initialDisplayMode,例如:

initialDisplayMode $= [RGBAMode, DoubleBuffered, WithDepthBuffer, WithAlphaComponent]

我有以下材料颜色和浅色:

clearColor $= Color4 0 0 0 0
materialSpecular Front $= white
materialShininess Front $= 50
lighting $= Enabled
light (Light 0) $= Enabled
position (Light 0) $= Vertex4 0 0 100 1
ambient (Light 0) $= white
diffuse (Light 0) $= white
specular (Light 0) $= white

0 个答案:

没有答案