antialiasing question

There isn’t a boolean for sample buffers, just an int which I have tried setting to 1 and 2 but with no success. The link I put in one of my previous posts
(http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/opengl/GLData.html) is the javadoc page for the GLData class. It has only 14 variables that I can set, and the only ones that I think would be relevant are samples and sampleBuffers.

I went through the open bug reports for SWT and found something about multisampling in embedded opengl. It was reported a couple years ago when an older version was out. It was marked as a feature enhancement request rather than as a genuine bug. I have no idea what the current situation with SWT-jogl and multisampling is though.

I’m inclined to believe that this may be a SWT problem as I’ve experienced the same sorts of things you’ve just described: anti-aliasing cannot be enabled on my SWT app unless I use the nVidia Control Panel and force it on. ie: I cannot have application-controlled anti-aliasing using SWT. I’ve also noticed that setting the GLData.samples and GLData.sampleBuffers seems to have no bearing on the number of mutisample buffers and samples that are in OpenGL app: it all just ends-up at 0 unless AA is forced via the nVidia Control Panel.

[EDIT]: Just took a look in the GLCanvas code to see what becomes of the GLData object, and lo and behold:

//FIXME - use wglChoosePixelFormatARB

// if (data.sampleBuffers > 0) {
// wglAttrib [pos++] = WGL.WGL_SAMPLE_BUFFERS_ARB;
// wglAttrib [pos++] = data.sampleBuffers;
// }
// if (data.samples > 0) {
// wglAttrib [pos++] = WGL.WGL_SAMPLES_ARB;
// wglAttrib [pos++] = data.samples;
// }

Yeah I recently came across that too. I have embedded an AWT frame in my SWT application and antialiasing works this way, but the performance is a lot worse than using an all-SWT approach with antialiasing forced from a control panel. I don’t know whether this originates from the awt frame or from the fact that I had to switch my mouse event listeners from an swt version to one in “java.awt.event.MouseAdapter”

Is there a way to create sample buffers and set the number of samples in a manner that does not involve the GLCapabilities and GLCanvas classes? In theory, such a method would be accessible to me without introducing an embedded AWT frame. I see a lot of methods in the GL javadoc page suggestive of being able to generate buffers, but I have no clue if they are relevant or how to use them.

While I haven’t given it a try myself, I believe the FIXME in the GLCanvas class arose from the situation described in the NeHe tutorial about antialiasing: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=46 Basically, you can’t query the pixel format (to see if multisampling is available) until the window is created, but you can’t create a multi-sampled window unless you know the pixel format. I came across something similar in the SWT bug reports, but that was in 2005 between one of the SWT OpenGL guys and Mithrandir of these forums: https://bugs.eclipse.org/bugs/show_bug.cgi?id=110757#c23

Maybe if you can figure a way around that situation, you could create your own OpenGL Canvas object that overrides SWT’s GLCanvas (provided that SWT allows overriding of the GLCanvas, I know SWT throws SWTException if you try to override many of it’s widget classes).

Even if it is possible to make your own glcanvas widget, I don’t think I am familiar enough with this stuff to figure out what needs to be changed. I guess this is a roadblock to what I wanted to do and I’ll probably have to make do using the embedded awt frame. Is anyone capable of confirming that full-scene multisample antialiasing can only be setup in jogl through the GLCapabilities class?