Porting Violet to Java

A forum for exporter development discussion.
User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Thu Jan 24, 2008 12:08 pm

OK I'll check what I have right now...

On windows:
1.6 appears to be installed.

On OSX:
1.5 appears to be installed. However, netbeans won't compile my code.
The errors appear to be swing related.

Code: Select all

... jVioletAboutBox.java:82:cannot find symbol
symbol : class GroupLayout
location : package javax.swing
 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
I thought Java was supposed to be nicely platform independant?
This is really stupid, I don't feel like this is getting anywhere.

I also don't expect the situation on Linux to be any different or easier, what with the rejection of most proprietary code grrr :x

User avatar
ViennaLinux
Posts: 191
Joined: Thu Jul 26, 2007 9:26 am
Location: Vienna/Austria
Contact:

Post by ViennaLinux » Thu Jan 24, 2008 12:16 pm

here you see their stupid naming scheme: http://java.sun.com/reference/api/

I think you GroupLayout is an new feature of java 6 :-(
But I am not sure
Core2duo e6600 @ 3.1GHz watercooled at default VCore ^^

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Thu Jan 24, 2008 12:41 pm

OK, well it's only GUI related - the GUI can be, and probably should be rebuilt anyway. My first layout isn't all that good.

Does java 5 support Generics ? that's the only other recent feature that I know I'm using.

User avatar
psor
1st Place Winner
Posts: 1295
Joined: Sun Jun 25, 2006 1:25 am
Location: Berlin
Contact:

Post by psor » Thu Jan 24, 2008 12:45 pm

Quick question, ... is this for intel only too? ;o)

edit: *Argh* I guess it's not the JDK, just the JRE ... *grmpf*




take care
psor
"The sleeper must awaken"

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Thu Jan 24, 2008 1:05 pm

OK, here's what I've done...

I removed the JDK6 GUI and rebuilt a basic one (erm, 1 imagePanel and 1 button :D ) using JDK5.

This project should now work on linux (tested), windows (not yet tested) and OSX (not yet tested).

I've committed my changes.

I'll make sure to set my Windows IDE to use on only java 5/1.5 to make sure it remains compatible.

Phew, that's 2 niggly problems solved this evening :) :D

User avatar
eman7613
Posts: 597
Joined: Sat Sep 16, 2006 2:52 pm

Post by eman7613 » Thu Jan 24, 2008 2:04 pm

you gave me the wrong path that was the problem (was trying /mti-jViolet).

Yes, Apple sucks as a java development platform, hopefully the OpenJDK project will fix that.

1.5 has Generics, yes. GrouLayout was in 1.5, its fine.

1.6 has that 1.5 dosn't (from a coding standpoint): SwingWorker with the JRE, a few desktop APIs, a few additions to default swing components, and integretade DB. (there is more but they arnt as related to writing code in java)

Any new CODING featuers in 1.6 generaly came from pre existing librarys on java.net and swinglabs.

Actually, linux is my preffered java development enviroment :) i like it a lot. in ubuntu, sudo apt-get install sun-java5-jdk, and done :)
Yes i know, my spelling sucks

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Thu Jan 24, 2008 10:08 pm

:oops: sorry about that wrong path.... so many three letter abbreviations to rememeber :twisted:

User avatar
ViennaLinux
Posts: 191
Joined: Thu Jul 26, 2007 9:26 am
Location: Vienna/Austria
Contact:

Post by ViennaLinux » Fri Jan 25, 2008 12:32 am

please compile it for java 1.5 and dont use java 6.
java 5 supports generics and all the stuff you will need.

I hate creating swing guis because you need a lot of practise and then its still not beautiful code :?

If you need a tester write me a PM. I can test mac os x and windows for you right now.
Core2duo e6600 @ 3.1GHz watercooled at default VCore ^^

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Fri Jan 25, 2008 12:52 am

ViennaLinux:
I'm setting the project up to run java 1.5 and it's working :)

Are you on intel OSX or PowerPC OSX?

I think probably between us we will be able to test most platforms.
I have access to the following
AMD and Intel 32bit: Windows XP 32bit, Ubuntu 7 32bit
Intel 64bit: Windows XP 32bit, Vista 64bit, Ubuntu 7 64bit
PowerPC (G4): OSX 10.4 and Ubuntu 7

User avatar
eman7613
Posts: 597
Joined: Sat Sep 16, 2006 2:52 pm

Post by eman7613 » Fri Jan 25, 2008 9:59 am

ViennaLinux wrote:I hate creating swing guis because you need a lot of practise and then its still not beautiful code :?
im recreating the current GUI from violet right now, will probably be done tonight/customary. The coding can get messey, but netbeans has a realy nice GUI builder and that helps a lot in just organizing everything
Yes i know, my spelling sucks

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Fri Jan 25, 2008 10:15 am

Cool eman, let me know when you want a username/password for the SVN.

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Fri Jan 25, 2008 11:37 pm

(this post is more of a note to myself than anything)

I've realised what the problem with the tonemapping is, and why it broke when i implemented multi-threading:

On each tonemapping pass, the entire image is scanned to get it's average luminance - and no matter if a thread is processing either the whole image or just a part of it, every thread must scan the whole image, something I saw as a potential slow-down.

So what I did was move the luminance calculation into the image loader routine - this is the error.

The luminance values should be calculated when the tonemapping is performed, not before. I guess we have to live with the fact the whole image needs to be scanned in every processing thread.

What I need to do is re-enable the routines in the Tonemapper superclass, and change a line is each of the XToneMapper subclasses and it should work again.
(and remove the luminance calculation from the image loader).

... that is unless there's another, more clever way around this problem.
[edit: how about:-
upon entering the getAverageLuminance routine, set a class var that tells other threads whether this value is being calculated or not - the first thread to get into this routine calculates the averageLuminance and stores it in the Image instance, and the other threads wait until this single thread has done the work, and simply retrieve the averageLuminance value from the Image instance ]

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Sat Jan 26, 2008 1:45 am

ok, I implemented luminance calculation, as per my note above.

when running multi-threads the first thread to call the getLuminance function will scan the whole image, and the other threads wait until it's finished and simply pick up the result.

User avatar
ViennaLinux
Posts: 191
Joined: Thu Jul 26, 2007 9:26 am
Location: Vienna/Austria
Contact:

Post by ViennaLinux » Sat Jan 26, 2008 2:35 am

cant you find out how many threads the cpu can do and then split the luminance calculation? so lets say 2 threads means one thread is created for the upper part of the image and the second on is for he lower part. of course then you need to sync the results somehow and its more to code.
Core2duo e6600 @ 3.1GHz watercooled at default VCore ^^

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Sat Jan 26, 2008 2:37 am

solution 1:
yes I suppose the luminance calculation could spawn it's own threads. not a problem.

edit: OR..
solution 2:
each image processing thread goes ahead and calculated it's part of the luminance and waits for the other threads to do their bit, and the last thread to complete sums up the total. then all threads can carry on in parallel.

damn, there's loads of ways this could work. I don't know what'd be more efficient though.
I guess solution 2 is better because it doesn't spawn a whole load of new threads.

Post Reply
137 posts

Who is online

Users browsing this forum: No registered users and 107 guests