Thread Subject: Redrawing graphics objects

Subject: Redrawing graphics objects

From: Ryan Ollos

Date: 15 Oct, 2008 00:12:01

Message: 1 of 3

I have an animation that moves an image around a 2D axes. I move the image by changing its 'Position' property. Also in the axes are a number of line objects, positioned vertically.

The problem I have is that the image is sometimes positioned over vertical lines, and I would like these lines to always be visible. When the image is position over these lines it hides a portion of the line.

The only solution I have found is to delete and recreate the lines after the image has changed position. I was hoping to find a faster (in terms of execution speed) way to do this by something like:
* re-rendering the lines
* somehow controlling the stacking order of objects in the image
* via the EraseMode property

The closest thing I have come up with is setting the EraseMode of the line objects to 'xor'. The problem with this is that the lines are not rendered in the specified color, as expected after reading the documentation for EraseMode = 'xor'.

Any ideas?

Thanks for your time!

Subject: Redrawing graphics objects

From: Walter Roberson

Date: 15 Oct, 2008 04:22:38

Message: 2 of 3

Ryan Ollos wrote:
> I have an animation that moves an image around a 2D axes. I move the image by changing its
> 'Position' property. Also in the axes are a number of line objects, positioned vertically.

> The problem I have is that the image is sometimes positioned over vertical lines, and I
> would like these lines to always be visible

Which renderer are you using? If you are using the OpenGL renderer (only), then
the stacking order of lines compared to flat objects at the same Z plane ignored.
-Somewhere- it is documented which will show up on top, but I have found that
in practice it depends upon your graphics drivers and upon your operating system --
e.g., for me on Linux-64 over X, the order is the reverse of what is documented.

If you are using any renderer other than OpenGL, then the stacking order is
supposedly obeyed... but OpenGL is the only renderer that supports transparency...
In theory if you add a small Z offset to either the line or the image
(or patch) then they will no longer be in the same plane and the one that
is "closer" to the viewpoint will appear "on top".

Subject: Redrawing graphics objects

From: Ryan Ollos

Date: 15 Oct, 2008 06:26:01

Message: 3 of 3

Walter Roberson <roberson@hushmail.com> wrote in message <SdeJk.734$1r2.316@newsfe01.iad>...
> Which renderer are you using? If you are using the OpenGL renderer (only), then
> the stacking order of lines compared to flat objects at the same Z plane ignored.
> -Somewhere- it is documented which will show up on top, but I have found that
> in practice it depends upon your graphics drivers and upon your operating system --
> e.g., for me on Linux-64 over X, the order is the reverse of what is documented.
>
> If you are using any renderer other than OpenGL, then the stacking order is
> supposedly obeyed... but OpenGL is the only renderer that supports transparency...
> In theory if you add a small Z offset to either the line or the image
> (or patch) then they will no longer be in the same plane and the one that
> is "closer" to the viewpoint will appear "on top".

Hi Walter,

Thank you for the ideas. I'm on Win Vista, and I tried all 3 renderers. Zbuffer and OpenGL behave like you described for OpenGL. It seems like the stacking of the objects is random when using these Renders because there is a lot of flashing as the image updates.

Adding a zdata offset when using the painters renderer works well.

It would be nice to figure out a way to control the stacking order when using OpenGL, but I'm very happy this is working with Painters.

Thanks!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
image Hyoungsoon Lee 20 Apr, 2009 22:41:27
position Hyoungsoon Lee 20 Apr, 2009 22:41:27
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com