Login  Register

Re: png's flipped vertically

Posted by Sven Gothel on Jul 07, 2012; 11:04am
URL: https://forum.jogamp.org/png-s-flipped-vertically-tp4025452p4025457.html

On 07/07/2012 05:28 AM, Mike [via jogamp] wrote:
> I did a little digging, and it turns out that the textures drawing upside down
> were returning 'true' for the method Texture.getMustFlipVertically(). So my
> solution is to check if the Texture objects need to be flipped and manually
> flip them before rendering.

Either you use the provided texture coordinates by Texture object,
or you swap the Y-axis in your tex-coords yourself.

<http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/texture/Texture.html#getImageTexCoords%28%29>

Now we use PNGJ <http://code.google.com/p/pngj/> for PNG texture loading,
which is AWT independent and pretty much more efficient.

> Is there maybe a better solution than this? Why do the textures get loaded in
> upside down in the first place?

Since it's much faster to flip a texture using it's texcoords than
swapping the memory content - this is the best solution.

~Sven


signature.asc (910 bytes) Download Attachment