Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Confusion about OpenGL and SWT

Hello,

I am a little bit confused about how to properly go about using OpenGL with SWT, and I was hoping that someone might be able to clear up a few key things for me.

(I am new to this mailing list, so I am sorry if this has been asked before. I have checked the mailing list archives and I did not find any answers.)

Unless I am mistaken, the GLCanvas class in the package org.eclipse.swt.opengl provides a widget which hosts an OpenGL context.

However, the org.eclipse.swt.opengl package does not seem to provide any functionality for actually drawing anything in the widget. For this purpose, I assume, an additional binding to the actual OpenGL API functions is needed?

The "Using OpenGL in SWT Applications" (http://www.eclipse.org/swt/opengl) web page states the following:

"org.eclipse.opengl is an experimental Java binding for OpenGL 1.1 and GLU built as an Eclipse plugin".

My interpretation of this is that I should use the org.eclipse.swt.opengl.GLCanvas class for creating a canvas widget and then use the org.eclipse.opengl.GL class to actually draw things in the widget. Is this correct?

If so, I still get confused by the last paragraph (about the org.eclipse.opengl binding) on the same page which states:

"Please note that this binding is experimental and subject to change. If you are using SWT 3.2 or newer then you should use the supported OpenGL binding that is included in the SWT package instead."

Is there a binding for the OpenGL 1.1 API functions for drawing, like for example glVertex3f(), already included in SWT? Do I not also need the org.eclipse.opengl package? The binding in SWT only seems to provide support for creating an OpenGL widget and I don't see a way to use it instead of (as opposed to "along with") the org.eclipse.opengl package.

Any hints would be appreciated.

--
Martin Johannesson


Back to the top