Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - The Librarian

Pages: [1]
1
Support / SWT and JPCT?
« on: June 22, 2006, 10:59:00 am »
OK I'll do that :)

Actually the resize events are handled by the RCP framework and are sent only once per resize operation. Since I won't be using a render loop (the scene will be updated only after specific events such as player actions, network activity, etc.) it is really straightforward : add listeners, trigger the rendering at will. Frame rate is nearly constant : 0 :D (well, except during animations obviously).

And don't worry, I'll post some screenshots soon. And who knows, if I decide to stick with jPCT, you should see more of Sanctuaire on this forum :)

2
Support / SWT and JPCT?
« on: June 21, 2006, 01:19:20 am »
OK it works, thank you very much ! And in an RCP ViewPart too :)
If anyone is interested, here is the init() function I use :

Code: [Select]

private void init() {
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch(LWJGLException e) { e.printStackTrace(); }

buffer = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);


}


And the render() function :
Code: [Select]

private void render() {
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.swapBuffers();
}


Finally the createPartControl() function (since this is an RCP ViewPart) :
Code: [Select]

public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(composite, SWT.NONE, data);

canvas.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
render();
}
});
canvas.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event event) {
render();
}
});

                init();
        }


Don't forget the paint listener or it won't work :) (LWJGL related)

Oh and an extra question : is it possible to dynamically resize the framebuffer ? Or should I just make it as large as the screen and let the GLCanvas crop it when it is resized ?

Thanks !

3
Support / SWT and JPCT?
« on: June 21, 2006, 12:25:56 am »
Thanks a lot, I'll try that and keep you posted !

4
Support / SWT and JPCT?
« on: June 21, 2006, 12:02:01 am »
Tried something like this :
Code: [Select]

buffer = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_NORMAL);
   
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
   
IPaintListener listener = new IPaintListener() {
private static final long serialVersionUID = 4586527128365364279L;
public void startPainting() {
    Global.logger.debug("Start painting");
    canvas.setCurrent();
           try {
        GLContext.useContext(canvas);
           } catch(LWJGLException e) { e.printStackTrace(); }
    }
public void finishedPainting() {
        }
};
buffer.setPaintListener(listener);

buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();



Simply enabling the OpenGL renderer opens the jpct window, is this normal ? A side effect of the RCP framework, or something I did wrong ? Nothing is drawn in my GLCanvas...

In any case, it'll be great to have this engine available in SWT :)

5
Support / SWT and JPCT?
« on: June 20, 2006, 09:13:01 pm »
Okay, spent some time poking around, yielding nothing...

The SWT way to use LWGJL, as described in Snippet195, is using a GLCanvas :

Code: [Select]
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
GLCanvas canvas = new GLCanvas(composite, SWT.NONE, data);
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch(LWJGLException e) { e.printStackTrace(); }

//
// OpenGL stuff using the LWJGL bindings
//

canvas.swapBuffers();


Et voila, the scene is rendered in your canvas...

I tried to do basically the same stuff with jPCT : create the GLCanvas and init the GLContext. But when I call buffer.displayGLOnly(), a new window is created by jPCT.

Any idea on how to tell it to draw to the GLCanvas ? Or is a new version of buffer.display() necessary ?

Thanks !

6
Support / Eclipse 3.2 / SWT and JPCT
« on: June 20, 2006, 04:51:47 pm »
Hi there,

I've been working on an MMORPG project for some time now and I've recently decided to switch to 3D/OpenGL. Who is going to be suprised if I say that seeing the Technopolies screenshots greatly influenced my decision ? ;) (great work rolz !)

Anyway, I'm using the Eclipse RCP framework for the client software (the server being in Erlang), which means SWT/JFace everywhere. Since Eclipse 3.2, the LWJGL can be perfectly integrated with SWT, so I assume it won't be too much of a problem to use jPCT.

Has anyone tried that yet ? I'll try to get it to work tonight when I get home from work, and since I'm new to jPCT it may involve quite a few trials...

Thanks !

Pages: [1]