LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: DavidYazel on July 06, 2003, 15:17:16

Title: Window and offscreen rendering
Post by: DavidYazel on July 06, 2003, 15:17:16
According to the documentation only one org.lwjgl.Window can exist at once.  

1. Does this mean one window per machine or per VM?  Is this limitation in the DLL or in the Java code?  If I had my app running twice would they conflict?

2. If I want to render into an offscreen buffer and not effect the currently displayed frame is that possible?  So basically I would render, read the color buffer back to app but not swap?

Thanks!

Dave
Title: Window and offscreen rendering
Post by: elias on July 06, 2003, 17:37:21
The only-one-window is a design limitation to keep things simpler, like input. And it's an appreciation that almost any game will never need more than one window. Having two or more LWJGL apps running at the same time should not pose a problem.

Regarding offscreen rendering, yes, that's possible and you have two options:

1. Do the drawing to the back buffer and do a glCopyTexImage2D or similar.
2. Use Pbuffers coming in 0.7. Notice that render-to-texture is not supported yet, because a linux version of the extension is not available at the time. So you still need to do a glCopyTexImage2D.

- elias
Title: Window and offscreen rendering
Post by: DavidYazel on July 06, 2003, 18:26:42
Thanks for the answer!

Bummer about render to texture, I could really use that.  Any idea when that will be in Linux?
Title: Window and offscreen rendering
Post by: elias on July 06, 2003, 19:09:36
It wouldn't be that hard to implement on win32 only, but I figured users would be most interested in features widely available xplatform. As to when linux is ready, it really depends on the ARB. I know they have a GLX_render_texture in progress.

What do you need the offscreen rendering for? Copying to texture isn't so expensive as you might think - the transfer happens internally in AGP mem.

- elias
Title: Window and offscreen rendering
Post by: elias on July 06, 2003, 19:17:38
And when do you need it? If it's not "yesterday, thank you very much", chances are the feature will be implemented at that point.

- elias
Title: Window and offscreen rendering
Post by: DavidYazel on July 06, 2003, 20:15:52
I was going to use it for generating imposters dynamically, as well as building sphere and cube mapping textures for reflections.

It can wait a bit I am sure.
Title: Window and offscreen rendering
Post by: elias on July 06, 2003, 21:00:38
That sounds suspiciously like an offline or non-interactive process. Why do you need render-to-texture for that?

- elias