problem with JOGL in RCP [message #446505] |
Tue, 21 March 2006 07:52  |
Eclipse User |
|
|
|
Originally posted by: vze3gfkr.verizon.net
Hi
I am trying create a view in my RCP program that can display an opengl
view. I have the tried the code snippet 209 and everything works well.
however I cannot seem to get this to work under my RCP program. within
the view class I have added the following code under the
createPartControl method.
public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
GLData data = new GLData ();
data.doubleBuffer = true;
final GLCanvas canvas = new GLCanvas(parent.getShell(), SWT.NONE, data);
canvas.setCurrent();
final GLContext
context=GLDrawableFactory.getFactory().createExternalGLConte xt();
initialize3DWindow(context,canvas); // initialize the 3D window
create3DWindow(context,canvas); // draw the 3D object
}
The code compiles fine but i don't see anything. Is there any code
examples on how to do this with RCP or any documentation. Any help would
be greatly appreciated.
thanks
Fintan Mac Cormack
|
|
|
|
|
|
|
Re: problem with JOGL in RCP [message #446654 is a reply to message #446652] |
Wed, 22 March 2006 15:57   |
Eclipse User |
|
|
|
Hi,
you seem to be messing around with the Shell of Eclipse. The shell is a
the desktop-window of your eclipse rcp/ide. It's not a good idea to mess
around with it.
Have you tried to remove all these calls to the shell and just do the
following:
public void createPartControl(Composite parent) {
GLData data = new GLData ();
data.doubleBuffer = true;
final GLCanvas canvas = new GLCanvas(parent, SWT.BORDER, data);
canvas.setCurrent();
final GLContext
context=GLDrawableFactory.getFactory().createExternalGLConte xt();
initialize3DWindow(context,canvas); // initialize the 3D
create3DWindow(context,canvas); // draw the 3D object
}
Note that I pass "parent" to the GLCanvas constructor, not
parent.getShell().
parent.getShell() is something you want to leave alone.
Regards,
Stepan
fintan Mac Cormack wrote:
> Hi Dittmar
> I tried what you suggested but the view still does not display the 3D
> image. I am able to get the program to partially work by changing the
> code to the following.
> public void createPartControl(Composite parent) {
> Shell shell = parent.getShell();
> shell.setLayout(parent.getLayout());
> GLData data = new GLData ();
> data.doubleBuffer = true;
> final GLCanvas canvas = new GLCanvas(shell, SWT.BORDER, data);
> canvas.setCurrent();
> final GLContext
> context=GLDrawableFactory.getFactory().createExternalGLConte xt();
> shell.open();
> initialize3DWindow(context,canvas); // initialize the 3D
> window
> create3DWindow(context,canvas); // draw the 3D object
> }
> However this messes up the remainder of the gui such as menubar coolbar
> etc. however i am able to see part of the 3D image. Also the code only
> works when i add the line
> shell.open();
> regards
> fintan
> Dittmar Steiner wrote:
>> Hi Finatan,
>>
>> although I don't have experience with JOGL, in my oppinion it could be a
>> problem with the composite hierachy.
>> Please try to simply insert a Composite:
>>> public void createPartControl(Composite parent) {
>> Composite top = new Composite(parent, SWT.NONE);
>> top.setLayout(new FillLayout());
>>
>> But I may be totally wrong. I took this code from a project where I
>> create the content for an EditorPart.
>>
>> best regards
>> Dittmar
|
|
|
Re: problem with JOGL in RCP [message #446655 is a reply to message #446654] |
Wed, 22 March 2006 16:34   |
Eclipse User |
|
|
|
Originally posted by: vze3gfkr.verizon.net
Hi Stephen I tried your example but still no luck.
regards
fintan
Stepan Rutz wrote:
>
> Hi,
>
> you seem to be messing around with the Shell of Eclipse. The shell is a
> the desktop-window of your eclipse rcp/ide. It's not a good idea to mess
> around with it.
>
> Have you tried to remove all these calls to the shell and just do the
> following:
>
>
> public void createPartControl(Composite parent) {
> GLData data = new GLData ();
> data.doubleBuffer = true;
> final GLCanvas canvas = new GLCanvas(parent, SWT.BORDER, data);
> canvas.setCurrent();
> final GLContext
> context=GLDrawableFactory.getFactory().createExternalGLConte xt();
> initialize3DWindow(context,canvas); // initialize the 3D
> create3DWindow(context,canvas); // draw the 3D object
> }
>
> Note that I pass "parent" to the GLCanvas constructor, not
> parent.getShell(). parent.getShell() is something you want to leave alone.
>
> Regards,
> Stepan
>
> fintan Mac Cormack wrote:
>
>> Hi Dittmar
>> I tried what you suggested but the view still does not display the 3D
>> image. I am able to get the program to partially work by changing the
>> code to the following.
>
>> public void createPartControl(Composite parent) {
>
>> Shell shell = parent.getShell();
>> shell.setLayout(parent.getLayout());
>
>> GLData data = new GLData ();
>> data.doubleBuffer = true;
>
>
>> final GLCanvas canvas = new GLCanvas(shell, SWT.BORDER, data);
>> canvas.setCurrent();
>
>
>> final GLContext
>> context=GLDrawableFactory.getFactory().createExternalGLConte xt();
>
>> shell.open();
>
>> initialize3DWindow(context,canvas); // initialize the 3D
>> window
>> create3DWindow(context,canvas); // draw the 3D object
>
>
>> }
>
>> However this messes up the remainder of the gui such as menubar
>> coolbar etc. however i am able to see part of the 3D image. Also the
>> code only works when i add the line
>
>> shell.open();
>
>> regards
>> fintan
>
>
>
>> Dittmar Steiner wrote:
>>> Hi Finatan,
>>>
>>> although I don't have experience with JOGL, in my oppinion it could
>>> be a problem with the composite hierachy.
>>> Please try to simply insert a Composite:
>>>> public void createPartControl(Composite parent) {
>>> Composite top = new Composite(parent, SWT.NONE);
>>> top.setLayout(new FillLayout());
>>>
>>> But I may be totally wrong. I took this code from a project where I
>>> create the content for an EditorPart.
>>>
>>> best regards
>>> Dittmar
>
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11530 seconds