关于macOS:opengl 2.1中具有多重采样的抗锯齿?

Anti aliasing with multisampling in opengl 2.1?

我有一个带radeon X1600显卡的2007 Macbook pro。我正在尝试使用多重采样功能来消除锯齿。

使用GlView,这是我手头的信息:

渲染器信息为:

渲染器:ATI Radeon X1600 OpenGL引擎供应商:ATI Technologies Inc.内存:128 MB版本:2.1 ATI-7.0.52设备:MacBookPro2,2着色语言版本:1.20

我检查了arb_multisample的扩展信息,它说:
"在OpenGL 1.3中提升为核心功能",那么假设
在我的代码中,我可以简单地说(就像我在Opengl 2.1上一样):

glEnable(GL_MULTISAMPLE)

在我的应用程序代码中,我有一个数据结构,该数据结构包含以下信息:
顶点,索引和纹理,然后使用glDrawElements等渲染。
是三角形网格。

代码看起来像这样:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    (capi:define-interface stad-viewer (capi:interface)
      ((double-buffered-p :initform t :initarg :double-buffered-p :accessor double-
          buffered-p))
      (:panes
         (canvas opengl:opengl-pane
              :configuration (list :rgba t :depth t :depth-buffer 32 :double-buffered t)
              :min-width 1440
              :min-height 900
              :message"Stadium demo"
              :drawing-mode :quality
              :reader canvas
              :resize-callback 'resize-stad-canvas
              :display-callback 'redisplay-stad-canvas))
      (:layouts
         (main capi:column-layout '(canvas)))
      (:default-initargs :auto-menus NIL :title"Stadium Viewer"))    


;;; enable multisampling
(opengl:gl-enable opengl:*gl-multisample*)
(opengl:gl-sample-coverage 0.70 opengl:*gl-false*)

;;; some more opengl commands....

;;; rendering meshes
(dolist (wfmesh *wfmeshes*)
   (format t" ------ PREPARING MESH ---- ~A ~%" (mesh-name wfmesh))
   (multiple-value-bind (vertices indices)
        (prepare-mesh wfmesh)
      (let* ((gl-vertices (gl-vertexes vertices))
             (gl-indices (gl-indexes indices)))
        (if *texture-ids*
          (multiple-value-bind (texture-id found)
                    (gethash (mesh-name wfmesh) *texture-ids*)
             (when found
                (opengl:gl-bind-texture opengl:*gl-texture-2d* texture-id)
                (opengl:gl-tex-coord-pointer 2 opengl:*gl-float* 0
                                                   (gl-texels (mesh-vertices wfmesh)  
                                                        1.0 t)))))      
        (opengl:gl-vertex-pointer 3 opengl:*gl-float* 0 gl-vertices)
        (opengl:gl-draw-elements opengl:*gl-triangles*
                                   (length indices)
                                   opengl:*gl-unsigned-int*
                                   gl-indices))))

我还启用了如上所述的多重采样。但是,这就是我得到的:

锯齿状边缘清晰可见。

所以我的问题是:

  • 我的理解是多重采样是一项核心功能吗?
  • 是否仅需要启用多重采样并调用图形代码即可工作,还是需要更多一些步骤才能使多重采样工作?

  • 您是否正在使用可可NSOpenGLView? 因为这样您才可以在Interface Builder中启用多重采样。 无论如何,您都必须使用示例缓冲区专门创建渲染上下文。 无论如何,glEnable(GL_MULTISAMPLE)是不够的。 为了获得更多具体的帮助,您需要说明如何创建OpenGL窗口/视图。