lapfelix / ARKit-line-drawing

Changed the default ARKit project to draw a line where the camera is positioned
407 stars 53 forks source link

Unable to change line width, `glLineWidth` not effective #9

Open vincentschen opened 7 years ago

vincentschen commented 7 years ago

This line doesn't seem to be affecting the line width: https://github.com/lapfelix/ARKit-line-drawing/blob/master/ARKitDraw/ViewController.swift#L77

Do we have all the necessary imports/packages?

SPDEX commented 7 years ago

Did you find any solution for changing line width?

Jimw338 commented 5 years ago

This StackOverflow question seems to answer this. SceneKit doesn't provide a way to do it. But it's built on OpenGL ES, which does. But to do that you have to set a delegate for the view, and define a renderer:willRenderSceneAtTime: and call glLineWidth there.. But that's not using ARKit - I have no idea what to do with an ARKit SceneView.

And apparently you already tried that.

But that was as of Nov 2014. Apple has surely moved SceneKit to using Metal everywhere (iOS and Mac). And they may (read "should") have added something as simple as a "setLineWidthToInPixels" method to SCNGeometry. It seems rather obvious, considering that "line width" has been a rather simple attribute, all the way back to "SetLineWidth(int lineWidth)" back in the good old days with B/W low-res QuickDraw and Pascal.