|
|
||
Joshua Marinacci's BlogCommunity: Mac Java Community ArchivesOur new Java Scene Graph is open sourcedPosted by joshy on December 11, 2007 at 11:18 AM | Permalink | Comments (23)Today Sun announced the open sourcing (GPL) of the new Java scene graph that underlies JavaFX script. And I'm very, very excited about it. What is a Scene Graph?First, you may be wondering: What is a scene graph? It's a retained mode API. This means that you pass shapes and other graphics objects to the library and let it draw them on screen whenever a refresh happens. The API retains the graphics objects. This is different than Java2D which is an immediate mode API. This means that your code is called whenever the screen must be refreshed and you must invoke graphics drawing operations which draw to the screen immediately. So why is one better than the other? Well, a scene graph saves you the headache of caching, dealing with repaints, worrying about clipping rectangles, and many other annoying details of writing graphics code. It lets you focus on what your code should do, not how it does it. This makes writing graphically rich applications much easier. The scene graph also has built in support for filters like blurs, glows, and shadows. And it works seamlessly with Swing components. And finally, because so much of the graphics is abstracted away, the implementation can perform many interesting optimizations in the future, like preloading textures and primitives up to the graphics card. In short, it's a higher level of abstraction, just like going from assembly to C. You can still get down to the assembly level when you need to, but most of time you work at the higher levels. Why this is good?First of all, Java has needed a scene graph for a while. There have been several open source ones but not of them were terribly fast, and none of the could take advantage of pipeline hooks for hardware acceleration. Project Scene Graph, on the other hand, is built by the guys who work on Java2D, and we have the potential for all sorts of great acceleration (think pixel shaders). Since this scene graph supports the new JavaFX runtime, and my job is writing tools for JavaFX, I'm happy that it will be as fast as possible. You don't have to use JavaFX Script, though. Second, I'm very excited that we are open sourcing this code right from the start. It hasn't been included in a shipping version of Java yet, but instead of waiting (sometimes for years) we are open sourcing it before it ships. This is huge, and another example of Sun (my employer) doing open source right. (A fact that I'm thrilled about, as you can imagine). Third, this is a Java API. While it's initial purpose was to support JavaFX Script you can (and I have) code directly in Java. This means the API is useful not only from JavaFX and Java applications, but also from Groovy, Python, Ruby, and any other JVM based language. Zeroth of all, scene graphs are awesome. I've been wanting one for ages. They are a great way to build up interactive graphics. They let you focus on what your app does and let the API do the heavy lifting. I've been playing with it for a while and I'm positive we are going to see some really cool apps coming out of this. In fact, I've got a few cool demos up my sleeve which you'll see soon. So go to scenegraph.dev.java.net and check it out. Also read the PDF presentation from JavaPolis, BTW, this announcement has nothing to do with the secret I told you about last week. You've still got to wait a few more days for that. Problem and solution for compiling NetBeans on MacPosted by joshy on May 17, 2007 at 08:45 AM | Permalink | Comments (5)What follows is a particular problem I had compiling NetBeans on my Mac and my solution to it. I'm putting this in my blog not so much for my readers but for the future generations of Google travelers who may stumble across this same issue. I downloaded a fresh copy of the full NetBeans source and compiled it. This is what I got part-way through the compilation process:
I suspected this was due to using Java 6 instead of Java 5, since I knew there were some changes to the JDBC spec in Java 6. Switching to 5 didn't fix the problem but I finally figured it out this morning. To switch your JVM on the Mac you must use the Java Preferences application. You can reorder the JVMs Java Application Runtime Settings area of the main screen. Putting Java 5 first will only fix half of the problem, however. The NetBeans build scripts also use the JAVA_HOME environment variable when you compile from the command line. Normally this is not set on a Mac so changing the order of VMs won't affect it. However, I had manually set JAVA_HOME in my .bash_profile when working on another project. This was still set to Java 6! Changing it to Java 5 fixed my problem and let the compilation complete. Note that you'll need to do an 'ant real-clean' and delete the 'nbbuild/build' directory if you had already partly compiled with Java 6. So that's it. I hope this helps you. Tricked out maps and a new tile provider.Posted by joshy on February 22, 2007 at 05:08 PM | Permalink | Comments (18)In previous blogs I introduced the JXMapViewer and JXMapKit, all part of the SwingX-WS project. We're still working on improving these classes and have more good stuff coming. I recently added support for non-rectangular maps, which makes the 1:2 Blue Marble map tile properly. I also added variable size tiles which allows the JXMapKit zoom out further. These are all nice improvements, but don't really matter if mapping isn't important. I've been blogging about the JXMapViewer for a while now and some of you may wonder: why do I do this? Why does mapping matter? Well, I think it matters a great deal because maps are the way that we interact with the world on any scale larger than a few blocks. Maps let us find out where things are, and visually show information to others. In short; maps are an important way of visualizing information; and that means Java needs great support for mapping. The problem, however, is that we currently only have access to some NASA imagery, which some people feel isn't very useful. Well, I have two answers to that: Doing cool things with NASA's Blue Marble imagesThe best way to show people that maps can be pretty and useful is simply to do it. Here is a screenshot of a JXMapKit that has been tricked out with Painters and the Timing Framework. It is a simple travelog showing various points on the globe that I have visited, along with some descriptive text. The screenshot is pretty but you really need to see it live to get a feel for how the animations and rollovers work.
Though the data in this demo is hard coded it could easily be specified using applet parameters. This would let non-programmers embed it in their webpages, showing their own travelogs! All of the effects you see here were done using stock Painters and the Timing Framework, all part of Swing Labs. But what about the second part.... Getting a new free map source: Open Street MapsWe can now view street maps from the Open Street Maps project! If you haven't heard of this project before you should really check it out. It is a map put together by individuals tagging and uploading GPS traces to a shared database. They only have a few cities so far (mostly in Europe) but they are growing every day and could use more help. A simply amazing project! Here's a screenshot:
To get Open Street Maps in your own application use this provider:
And that's it. Street maps in your own app. But of course, the best thing to convince others that the JXMapViewer is worthwhile is quite simple: get people to build more apps! So lets build some more. If you have any application you've written using the JXMapViewer please email me or post it here. We'll highlight it on the SwingX-WS webpage and try to get it into the JavaDesktop.org project spotlight. Thanks everyone! - Josh Postscript: here is the source to both the applet demo and the OSM tile provider. The required jars are included. Musings on the new opportunities that Open Source Java bringsPosted by joshy on November 12, 2006 at 11:25 PM | Permalink | Comments (7)I have often said that I don't love Java because I'm at Sun. I'm at Sun because I love Java. I love Java so much that I wanted to work at a place where I can do the most good for the Java community, and Sun is definitely that place. Now that Java is open source I think it means only good things. The big announcement today: Java will be open sourced under the GPL. I think it makes a lot of sense because it protects Sun's interest in preventing forks and also the community's interest in knowing that Java will forever be available in the public sphere. The GPL has always provided an option to fork just in case someone takes the code in a bad direction. Historically having this option available ensures that it never needs to actually be used, letting the community grow and thrive. So what does this actually mean? What is the benefit to open source Java? How will things change? Here's what I think will change and what won't. I say this as my own opinion, not an official statement from Sun. I also say this as someone new to Sun, coming to Sun two years ago from an open source background. I'm sure that engineers with more experience than I will have different opinions. So with that, let's hear it: How will open source change Java
Okay, so maybe that last one is a stretch, but it's true that this will help to bring More Java to More Places. So now we have a free runtime, competition between three groups to make the best IDE in the world, and a language that scales from cellphones to desktops to super-cluster-matrix-grids-thingy's. It's a good time to be a software developer! Swing Hacks in Japanese ShipsPosted by joshy on May 03, 2006 at 09:45 AM | Permalink | Comments (1)I'm going to be a complete nerd for a second and expound upon how amazingly cool it is that something I wrote has been translated into Japanese. I mean, writing down words that someone else pays for is cool and all, but it's even cooler when someone else translates my words into another language. The book even looks cooler. It's a tad smaller and has a very nice book jacket. The paper has a very different feel from the english printing; manga-esque actually.
Many thanks to Yuka Kamiya from Sun's Japanese division for sending them to me and Chris. Extra special thanks to Miyagawa-san and the rest of the folks at O'Reilly for publishing such an excellent translation. Okay, back to your regularly scheduled english reading. How to get code completion with Javadocs in Netbeans on Mac OS XPosted by joshy on April 30, 2006 at 07:54 PM | Permalink | Comments (2)I'm sure I'm the last Mac Java developer here to figure this out so I'm posting it not so much for you but for future generations intrepid googlers to find. How to get Netbeans code completion with Javadocs to work in Mac OS XNetbeans is a great IDE and I'm really starting to warm up to it (starting to warm up to IDEs in general, actually). One of my big complaints so far has been the lack of Javadocs in the code completion popup window. Since I had some extra time today I thought I'd finally figure it out. The reason Netbeans doesn't have javadoc code completion on the Mac, but does on other operating systems, is that Apple doesn't ship the
Sweet! Swing Hacks Bonus ArticlePosted by joshy on August 12, 2005 at 05:36 AM | Permalink | Comments (3)Time stands still for no man. Technology even less so. The world moves on and we have to adapt. When Chris and I started writing Swing Hacks it represented the most advanced Swing techniques that we knew at the time. That was almost a year ago, though, and the world has moved on. Java 1.5 has become mainstream (on Windows at least), we've had a successful Desktop track at Java One, and I've joined the Swing team at Sun. As we were writing the book (and in the months since then) we learned lots of new things, some of which didn't make it into the book for space or time reasons. I've collected some of this new material into an article called Hacking Swing with Undocumented Classes and Properties containing lots of little undocumented features we've discovered over the years. I was especially disappointed that I didn't get my favorite hack, transparent frames on Mac OS X, into the book so I made sure to include that here. This is my first article for OnJava.com so be sure let me (and O'Reilly) know what you think.
Thanks Mac OS X 10.4 has arrived, with a Hi-Rez secretPosted by joshy on April 29, 2005 at 05:46 AM | Permalink | Comments (1)As everyone on this side of the galaxy must know by now, Tiger, version 10.4 of Mac OS X (will they ever hit Mac OS XI?), has finally arrived. If you're a Mac head like me you've been eagerly awaiting it at least since the previews last summer, if not from day 2 of 10.3's release. You will certainly be inundated with reviews, praise, and 'news flashes' about Tiger so I won't contribute to the fray. I'll just say that it looks really good and I look forward to buying the Family Pack. (I wish more companies would make Family Pack versions of software). My best advice is to go read the Ars Technica review of Tiger. It's incredibly in-depth and has discussion of under-the-hood changes that you won't get elsewhere. Definitely worth reading through. The extensible meta-data and kernel hooks for file updates are very exciting. Oh, yeah, like all versions of OSX it's faster than Panther on the same hardware. I wish all software was like that. Of particular note, however, is on page 20 (yes, the review is more than 20 pages long, but it's worth it, I swear!) About a third of the way down you will see a mention of a Scalable User Interface! It's turned off by default and only configurable with their debug application, but it works. You can use a slider to increase user interface resolution of each window separately. Vector graphics and text scales smoothly but bitmaps don't look as nice (as would be expected). An interesting hack, but mainly important because it indicates that Apple is thinking along these lines and they are laying the groundwork for completely scalable user interfaces. Anyway, just an interesting tidbit to think about this cheery Friday morning. - josh | ||
|
|