Skip to main content

[JAVA2D] Perspective transform and the Java 5.0 OpenGL pipeline

3 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Campbell

Hi Emmanuel,

The short answer is no, unfortunately. In a future release we hope to
have better interoperability between Java2D and JOGL, and this is
something we can take into consideration. Another possibility would be
to add support for PerspectiveTransform in core Java2D, at which point
we could potentially accelerate this operation when the OGL (or D3D)
pipeline is enabled. It's unlikely that we would do this anytime soon
though.

I've seen a handful of people request something like this, but usually
they find they can "fake" the effect using shear or something similar.

Chris

On Sep 5, 2005, at 11:44 PM, Emmanuel Pietriga wrote:
> Hello,
>
> I am wondering if there is any way to achieve non-affine
> transformations
> such as a perspective transforms when using Java 5.0's new OpenGL
> rendering pipeline, even if it means doing low-level operations such as
> tampering with the transformation matrix directly?
>
> I know of JAI's PerspectiveTransform which does what I want but is much
> too slow for what I want to do.
>
> Agile2D [1] (another OpenGL-based Java2D rendering engine based on the
> (now dead?) GL4Java project) provides a simple and very efficient way
> of
> achieving perspective transforms. This method is very fast as it does
> the transform directly at the OpenGL level.
>
> Is it possible to do the same thing with Java 5's OpenGL pipeline? If
> so, where can I find documentation about it?
>
> Thanks,
> Emmanuel
>
> =======================================================================
> ====
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Emmanuel Pietriga

Chris Campbell wrote:
> Hi Emmanuel,
>
> The short answer is no, unfortunately. In a future release we hope to
> have better interoperability between Java2D and JOGL, and this is
> something we can take into consideration. Another possibility would be
> to add support for PerspectiveTransform in core Java2D, at which point
> we could potentially accelerate this operation when the OGL (or D3D)
> pipeline is enabled. It's unlikely that we would do this anytime soon
> though.
>
> I've seen a handful of people request something like this, but usually
> they find they can "fake" the effect using shear or something similar.

I thought about that, but shear preserves "straightness" and
"parallelness" (as said in the javadoc), and the "fakeness" is quite
obvious when one wants to replace an actual perspective transform by a
combination of affine transforms.

Thanks for your answer,
Emmanuel

>
> Chris
>
> On Sep 5, 2005, at 11:44 PM, Emmanuel Pietriga wrote:
>
>> Hello,
>>
>> I am wondering if there is any way to achieve non-affine
>> transformations
>> such as a perspective transforms when using Java 5.0's new OpenGL
>> rendering pipeline, even if it means doing low-level operations such as
>> tampering with the transformation matrix directly?
>>
>> I know of JAI's PerspectiveTransform which does what I want but is much
>> too slow for what I want to do.
>>
>> Agile2D [1] (another OpenGL-based Java2D rendering engine based on the
>> (now dead?) GL4Java project) provides a simple and very efficient way
>> of
>> achieving perspective transforms. This method is very fast as it does
>> the transform directly at the OpenGL level.
>>
>> Is it possible to do the same thing with Java 5's OpenGL pipeline? If
>> so, where can I find documentation about it?
>>
>> Thanks,
>> Emmanuel
>>
>> =======================================================================
>> ====
>> To unsubscribe, send email to listserv@java.sun.com and include in the
>> body
>> of the message "signoff JAVA2D-INTEREST". For general help, send
>> email to
>> listserv@java.sun.com and include in the body of the message "help".
>
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

--
Emmanuel Pietriga
INRIA Futurs - Projet In Situ tel : +33 1 69 15 34 66
Bat 490, Université Paris-Sud fax : +33 1 69 15 65 86
91405 ORSAY Cedex FRANCE http://www.lri.fr/~pietriga

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Michael Slade

I had an application running under JDK 1.3 that created antialiased text in
a buffer of TYPE_INT_ARGB that was then stored in a png file with an alpha
channel - worked great. Here is a fragment of an image that illustrates the
quality:
http://www.adlibmedia.com/pngs/video_graphicJDK1.3.png
(notice white text with black drop shadow, grey antialiase pixels and alpha
channel)

but under JDK 1.4.2, the font got wider and taller (by about 1 pixel) and
some of the antialiased pixels are now brown or blue instead of gray. Here
is a fragment of the image that demonstrates the problem:
http://www.adlibmedia.com/pngs/video_graphicJDK1.4.2.png

Here is a code fragment that prints the shadow or the foreground
/*
** This method adds a line of left-justified text to the current
** graphic.
*/
public static void addLeftJustifiedText(String s, Graphics2D g2d, float
xPos, float yPos)
{
// get the font render context and calculate the position
FontRenderContext fntCntxt = g2d.getFontRenderContext();
Rectangle2D bounds = g2d.getFont().getStringBounds(s, fntCntxt);
g2d.drawString(s, xPos, yPos);
}

I'm scratching my head trying to figure it out. I looked at the archive for
this list and didn't see anything. I set every hint I could find. I'm
guessing something basic and obvious changed that I'm missing in the
documentation.

Any suggestions?

Thank you,
Michael Slade

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".