Suggestion / Call to Arms: JOGL Bridge Utilities

You know, after looking at the demos and seeing the amount of code that floats around these forums, I got to thinking.

There are only so many ways to make a fullscreen window. There are only so many ways to handle the problem where AWT and OpenGL have opposite direction Y values. Everybody could use a feature to extract the current buffer to a java.awt.Image file for saving as a screenshot. The dynamic lib loader discussed on another thread is another great example. It’s obvious people have written these kinds of things. And while JOGL is intended as a straight binding, it seems to me that there is no reason everybody should have to implement these basic functions of a game window.

I’m sure people will reply and say, there’s LWJGL and all of those things, and they’d be absolutely right. But, those are large, overarching frameworks for a certain kind of task; game development and so forth. What I’m wondering is if Ken and the JOGL gang could accept submissions on this forum for just incredibly useful, GENERAL PURPOSE functionality that can be seen as needed in 75% or more of JOGL apps. Take the best ones, focusing on the relationship between AWT/Swing and JOGL, and create a few additional classes for the utils package… Perhaps a subclass of JFrame that incorporates a GLCanvas or GLJpanel and includes such user methods as toFullScreen(), scaleToFitFrame2D(), and getBackBufferAsImage()? How about a GLImage class that wraps the byte buffers we use to render 2D graphics? Again, we’re not looking for “HalfYourProject.class”… Just some basic, everybody-needs-it functionality.

Doing it this way, asking for tested, proven submissions from the forum, is also a benefit because you get the work done without taking your time from the new JSR. Additionally, it gives forum members, who can’t get Developer status on JOGL because the team is kept very small, a chance to contribute to this great project, get a little kudos for it, and feel great. I know of a few small things I’d submit, and I’d love to say some of my code was being distributed with JOGL.

Anybody have any suggestions / comments / TESTED and LICENSE-FRIENDLY submissions?

Good suggestion, and I believe http://javaalmanac.com
serves as a great example. Focus on little snippets of code
that works without using any ‘frameworks’.

Definitely. There’s a big difference between, “this toolkit gives you a game engine” and “this toolkit gives you a general purpose window you can draw stuff in.” It’s almost 2006. There’s no reason we should still be writing code to make a window go full screen on Alt-Enter.

It would be a great help if you or others would pick up some of the bugs/RFEs on the JOGL Issue Tracker and bundle up the enhancements for the JOGL utility package. Things like font rendering (2D and 3D), screen grabbing, printing, etc. have mostly already been written and just need to be organized into some sensible classes and checked in. Please submit patches at first. I’ll be happy to review the first couple you or others submit and will discuss giving you or others write access to the repository afterward.

I’ve found making full-screen support work generically to be a little tricky. See the fullscreen demos for some of the workarounds that seem to be necessary to make it work portably. We might be able to bundle this up in another way; for example, temporarily adding a GLEventListener to do the reshape of the window just before going fullscreen and removing it once it’s been called.

FYI, I’m planning to redo the Animator class pretty soon so you might want to pick up integration of the screen grabbing utilities or something else first.