Hi Chet,

I have the java 3D Canvas, java 2D stuff and the swing components in
different panels already.  There is no overlaping of the panels.  It is
a java 2D window being clipped by the JScrollPane.  I am aware of the
heavyweight/lightweight problem, and we have worked around this (by using
the paintComponent of JPanel).

I guess I can code a work around, but it would be nice if anyone knows
what this problem is.

Cheers,

Hugh

>Delivered-To: [EMAIL PROTECTED]
>X-Accept-Language: en
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>Subject: Re: [JAVA2D] Java 2D and 3D together causes slowdown,is this a context
switching problem?
>Comments: To: "Mr H. Morgan" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>
>Hugh,
>
>I don't know off-hand what would cause the performance problem,
>but I know that combining Java2D (or Swing) and Java3D is problematic.
>The problem is that Java3D assumes that they own the entire canvas
>that you are drawing to, which does not work very well with the
>lightweight primitives that Java2D/Swing might try to draw into that
>same canvas.  In general, you will get undefined results (such as
>not being able to see a Swing primitive that is drawn into that
>canvas, since Java3D blasts right over it).
>
>The main workarounds that I know of at this time are to either
>use the 2D primitives of Java3D (I think they have a basic subclass
>of Graphics2D that allows you to draw 2D into the Java3D canvas), or
>to use entirely separate panels/windows for the 2 drawing systems.
>As you are using Swing instead of Java2D, it sounds like the latter
>(separate panels) is the better approach for you.
>
>In a future release, we hope to allow these APIs to co-exist better, but
>for now the workaround will have to do.
>
>As far as the performance problem, maybe there is an issue with Java3D
>when you try to create a window over the Java3D canvas; perhaps it
>cannot handle its window being clipped by the JPanel window?  Again, the
>separate panels approach (non-overlapping) should fix the problem if
>this
>is the case (although whether this would be suitable for your particular
>application is not clear to me).
>
>Chet.
>Java2D
>
>
>"Mr H. Morgan" wrote:
>>
>> Hi All (on both lists),
>>
>> I suspect a context switching problem, or some similar conflict between
>> java 2D and 3D rendering.  I am not sure, and any suggestions would be
>> appreciated.
>>
>> Description of problem -
>>
>> I have an application that has a Java 3D Canvas (using Xj3D) to display
>> the main data and a number of other panels (swing and java 2D) in the
>> same window to display the controls and "metadata".  Up until now I had
>> very good performance.
>>
>> I have just added a large JPanel, enclosed in a JScrolPane.  I draw
>> onto the JPanel with java 2D, and scroll around the panel programmatically
>> (no automatic scroll bars).
>>
>> If I have either the Java 3D Canvas or the large JPanel (about 4000
>> characters with coloured blocks behind them), the performance is good.
>> If I have them both, then the frame rate drops to 1 frame every few
>> seconds.  It is the Java 3D canvas that is taking the time.
>>
>> Am I doing something wrong?  Is this unavoidable with large java 2D and
>> java 3D objects at the same time?
>>
>> See http://www.hgmp.mrc.ac.uk/~hmorgan2/context/index.html for a
>> picture, and possibly some more info if I think of anything else that
>> needs saying.
>>
>> Thanks for any help,
>>
>> Hugh
>>
>> PS. I know the obvious way to solve this is to only draw the bit of the
>> JPanel that is seen and dispence with the JScrollPane, but I would
>> really like to know the reason for this problem.
>>
>> ===========================================================================
>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
>> [EMAIL PROTECTED] and include in the body of the message "help".
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA2D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to