swift - 替换已弃用的函数 glLineWidth()

标签 swift opengl-es scenekit augmented-reality arkit

我需要一个属性或方法来控制线宽。有用且简单的函数 glLineWidth() 现已弃用:

func glLineWidth(_ width: GLfloat)

我可以使用什么函数来代替已弃用的函数

这是制作 3D 线的代码:

class func drawLine(vector vector1: SCNVector3,
                  toVector vector2: SCNVector3) -> SCNGeometry {

    let indices: [Int32] = [0, 1]
    let source = SCNGeometrySource(vertices: [vector1, vector2]
    let element = SCNGeometryElement(indices: indices, primitiveType: .line)
    let geometry = SCNGeometry(sources: [source], elements: [element])
    return geometry
}

最佳答案

OpenGL 中没有替代品,Metal 中不存在此功能。

关于swift - 替换已弃用的函数 glLineWidth(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57484013/

相关文章:

ios - 当原始类不可用时如何解码对象?

macos - SceneKit 约束如何与骨骼一起工作?

ios - 难以从 iPhone X 上的 2D 区域获取面部标志点的深度(SceneKit/ARKit 应用程序)

ios - UIViewController 中的 SKScene

iOS Core Plot with Swift - 格式化 Axis

c++ - 使用 vbo ,使用着色器绘制纹理,但不显示任何内容

android - Opengl-使用着色器,有必要吗?

android - 在 android 中捕获时对视频应用效果?

ios - 代码签名错误每当我尝试在新的 SceneKit 应用程序中替换库存文件时

xml - 如何在 Swift 中解析 XML Web 服务?