Just curious about how far LWJGL has come in binding with native UI libraries like AWT, Swing, SWT. I've seen talk of SWT adapters and I've seen applets floating around which suggests AWT interaction, but I haven't encountered any documentation that really talks about using LWJGL properly when bound to any of these UI APIs.
Any pointers?
There is no AWT binding yet but all it requires is someone to build a very cut-down JOGL adapter I think, or failing that, we might produce our own. It's a trivial piece of work as far as I can tell. There is an SWT binding somewhere but I'm not sure of its status... someone should be along to chip in and explain...
Cas :)
Does Display have a mechanism built into it to grab the 'display frame' in a pixel format that can be displayed in an image or similar? If so I'll throw one together this weekend. Only thing I need is the actual framebuffer contents to paint to the component.
That's not Display's job - all you need is to use glReadPixels.
Cas :)
Is there a utility class somewhere that has access to the frame buffer? I want to be able to intercept the GL stream generically
FrameBufferAdapter
public static Image getFrameImage()
{
// read the pixels into a byte[]
// conver the byte[] into an image of desired pixformat
// return image
}
Component
public void paint( Graphics g )
{
// get the frames image
Image frameImage = FrameBufferAdapter.getFrameImage()
// draw this image to the component
g.drawImage( frameImage, 0, 0, null );
}
From JGF: printing frame content?
http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1105653528
Quote from: "tomb"From JGF: printing frame content?
http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1105653528
Nah, this is a move in the other direction - taking the lwjgl frame buffer and giving it to a component or similar so that lwjgl could be used comfortably in Swing/AWT applications.
Isn't that what "BufferedImage ImageUtils.readPixels(GL, int, int, int, int)" does? Just paint the image you got from the method on your AWT component.
Quote from: "tomb"Isn't that what "BufferedImage ImageUtils.readPixels(GL, int, int, int, int)" does? Just paint the image you got from the method on your AWT component.
It can, but the idea is to NOT use AWT because of the heavyweight/lightweight mixing problems. If you use AWT and you mix in Swing, you're going to have a host of drawing problems. The only way to get around this is to extend component and manage your own paints.
Well, you've got a BufferedImage containing the content of the OpenGl frame buffer. Does not mather if you use the BufferedImage with AWT or Swing. Use it in whatever way you want. The ImageUtils.readPixels function does exactly what you sugested with FrameBufferAdapter.getFrameImage().
Of course you don't want to show the LWJGL window, but I think you can create a headless window and render to a pbuffer or somehting. Have a look at http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=LWJGL;action=display;num=1105441572
What am I missing?
Quote from: "tomb"
What am I missing?
ImageUtils in the standard disto.
Quote from: "gregorypierce"Quote from: "tomb"
What am I missing?
ImageUtils in the standard disto.
standard disto?
I was refering to the code written by Shadowcaster2 in the "printing frame content" thread.