lambdacube3d / lambdacube-compiler

LambdaCube 3D is a Haskell-like purely functional language for GPU. Try it out:
http://lambdacube3d.com
Other
85 stars 9 forks source link

Question: How to pass Lines into mesh? #7

Closed NCrashed closed 8 years ago

NCrashed commented 8 years ago

Hi, I have stuck at wireframe mesh rendering, as I couldn't find 'P_Lines':

data MeshPrimitive
  = P_Points
  | P_TriangleStrip
  | P_Triangles
  | P_TriangleStripI (Vector Int32)
  | P_TrianglesI (Vector Int32)
  deriving (Show, Eq, Ord)

I know the workaround is to pass fake point across each line and render them as triangles, but I am curious if that mesh primitive is planned.

csabahruska commented 8 years ago

Hi, The Mesh type is just for convenience. As a workaround you can use the lower level API. Here's how it's done for Mesh: LambdaCube/GL/Mesh.hs LambdaCube/GL/Type.hs But if you're on GL33 for wireframed triangles just use PolygonLine in rasterization context. But it does not work on GLES 2.0 or WebGL 1.0

csabahruska commented 8 years ago

Do you need Line Mesh primitives also? I can add it.

NCrashed commented 8 years ago

Thanks, I added fake third point and switched to PolygonLine.

It was a debug code to render TrueType font contours.