I have a 2007 Macbook pro with ATI radeon X1600 graphics card. I am trying to get anti aliasing working using multisampling feature.
Using GlView , this is the information that I have at hand:
The renderer information is:
Renderer: ATI Radeon X1600 OpenGL Engine Vendor: ATI Technologies Inc. Memory: 128 MB Version: 2.1 ATI-7.0.52 Device: MacBookPro2,2 Shading language version: 1.20
I checked the extension information for the arb_multisample and it says: "Promoted to core feature in OpenGL 1.3", is it then correct to assume that in my code I can simply say (as I am on Opengl 2.1):
glEnable(GL_MULTISAMPLE)
In my application code, I have a data structure, which has the following information: vertices, indices and textures which I then render using glDrawElements etc. Also all are triangular meshes.
The code looks something like this:
(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))))
Also I have enabled multisampling as above. However this is what I get:
The jagged edges are clearly visible.
So my questions are:
Are you using a Cocoa NSOpenGLView? Because then you can just enable multisampling in Interface Builder. In any case, you must create your render context specifically with sample buffers. In any case, glEnable(GL_MULTISAMPLE) is not enough. In order to get more specific help, you need to state how you create your OpenGL window / view.