Finished all the tile writing tools. Today I'm working on Undo/Redo support, and handling some errors. Also might work on some non-tile writing related TileLayer editing functionality. Pushing back clip selection tools. Might not even include them as they're seeming a little overkill now.
I noticed some serious lag when rendering many, many images. Ah, Java2D's old nemesis, software rendering... this isn't entirely true. I'm doing a lot of scaling to simulate zoom. So I did some tests and determined there is lag when rendering many small images, even without scaling. How many do I consider "many?" Lets say 2500 or so.
So I started looking for hardware accelerated graphics. I'd planned on adding a plug-in for hardware accelerated rendering anyway, and I can always work to optimize rendering with Java2D later right? So I started by looking into LWJGL and JOGL in depth.
LWJGL only uses heavyweight components while JOGL focuses on lightweight. Also JOGL seems to have more of Sun's support and has MUCH MUCH better documentation than LWJGL. Unfortunately, JOGL development is very inactive, JOGL seems less popular, and seems more platform focused than LWJGL (ie. individual builds of the project for each OS.) Bad news for a Java application like mine, aiming at all platforms. So I settle with LWJGL for all those reasons.
Thus begins my nightmare of dealing with AWTGLCanvas. First its heavyweight. It doesn't fit in my nice JScrollPane. So I put it in ScrollPane. No, this doesn't work either. ScrollPane flickers in and out of view beneath the pane. So I have to write a custom scroll bar beneath the panel. Fine, I can handle that. What I didn't plan on was struggling for 3 hours trying to figure out why my rendering was so distorted. Eventually I figured it out. I was calling glOrth to set my perspective correctly, but was not setting the clipping planes with glViewport.
I also learned about an alternative to Swing/AWT called SWT (though I hardly consider AWT a real option nowadays.) Maybe I'll look into SWT once I get everything else functioning in my editor.
No comments:
Post a Comment