[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform.swt] SWT OpenGL in a plug-in problems
|
I have been having serveral problems moving a functional stand alone SWT
OpenGL application to a plug-in. Some of these problems have been solved
and some have not.
The ViewPart code is (slimmed down significantly):
public class SampleView extends ViewPart
{
public SampleView() {}
public void createPartControl(Composite parent)
{
Canvas glCanvas = new Canvas(parent, SWT.NONE);
GLContext glContext = new GLContext(glCanvas);
}
public void setFocus() {}
}
The plugin.xml is essentially:
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.swt.opengl"/>
</requires>
with the appropriate extention (view).
The first problem was in using the OpenGL plugin:
java.lang.NoClassDefFoundError:
org/eclipse/swt/internal/opengl/win32/PIXELFORMATDESCRIPTOR
at org.eclipse.swt.opengl.GLContext.<init>(GLContext.java:34)
It seems that the OpengGL internal package is
org.eclipse.swt.internal.opengl rather than
org.eclipse.swt.opengl.internal. This was quickly rectified by modifying
the OpenGL's plugin.xml to export the org.eclipse.swt.internal.opengl
package. This should be fixed in the original source so that this
modification is not necessary.
The second problem was the native gl library from the fragment. The
plugin reported the following:
java.lang.UnsatisfiedLinkError: no gl-win32-2133 in java.library.path
After renaming the .dll I still could not get the plugin to find it. This
is still unresolved. Adding the .dll to the java.library.path is not an
option as it should be read automatically (just as the swt .dll is found
without adding it to the java.library.path in a plugin). I temporarily
solved this by placing the .dll into the SWT's os directory. I have
limited plug-in experience so I could be doing something wrong, but as
making org.eclipse.ui a required plug-in allows the SWT .dll to be found,
I assume making org.eclipse.swt.opengl a required plug-in should do the
same.
The final show stopper is the following:
java.lang.UnsatisfiedLinkError: ChoosePixelFormat
at org.eclipse.swt.internal.opengl.win32.WGL.ChoosePixelFormat(Native
Method)
at org.eclipse.swt.opengl.GLContext.<init>(GLContext.java:47)
It seems that the .dll that the ChoosePixelFomat function is in cannot be
found. I have gone to great lengths short of making the extire system32
directory part of the java.libraray.path to no avail.