Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] TextureIO creating flipped textures?  (Read 1349 times)
0 Members and 1 Guest are viewing this topic.
Offline Cork

Junior Devvie

vote 6uN for OSX

« Posted 2009-09-02 21:43:56 »

I remeber long ago there was some discussion with flipped textures and TextureIO.  Whats the current situation?  I've only recently switched to TextureIo functionality, but today I noticed one of my .png textures is vertically flipped!  Maybe they all are but I can't tell Smiley
So whats the best solution for flipping it back? .png, utility? texture co-ords?
Offline spiraljetty

Senior Newbie

« Reply #1 - Posted 2009-09-03 08:24:46 »

Once you have your texture, you can call getImageTexCoords() to get the TextureCoords for your Texture and then you can use the bottom(), left(), right(), top() methods instead of specifying 0s and 1s for your texture coordinates. Also you can check the getMustFlipVertically() method and handle it yourself. I haven't noticed any issues with images being flipped since I migrated to JOGL2 and I use the TextureCoords helper class.
HTH, sj
Offline Cork

Junior Devvie

vote 6uN for OSX

« Reply #2 - Posted 2009-09-03 09:30:35 »

I pulled my model and .png back into blender and it looks fine.  So it must be TextureIO class.

update: I just had a look at the method you mentioned getMustFlipVertically().  That's returning true! which I assume means that TextureIO is doing the flipping.  I would expect to see another method to correct this, but can't find anything so far.

The TextureCoords approach won't work for me as far as I can understand it.  I'm multiplying up my texture co-ords to point to different bits of my texture.  I could flip my text coords at that point, but I'd rather have the texture the right way around in the first place.

So what's the best approach for flipping the Texture? or does it have to remain flipped for internal workings?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline spiraljetty

Senior Newbie

« Reply #3 - Posted 2009-09-03 12:02:57 »

You could use getSubImageTexCoords(int x1, int y1, int x2, int y2) which would give you TextureCoords properly at various regions of your image texture. Or you could first load up the image as a BufferedImage and use the ImageUtils.flipImageVertically(BufferedImage image) method before using the AWTTextureIO class to turn it into a Texture using newTexture(BufferedImage image, boolean mipmap). I don't know if there are better ways to do it. -sj
Offline Cork

Junior Devvie

vote 6uN for OSX

« Reply #4 - Posted 2009-09-08 20:20:20 »

I ended up with your idea, thanks! Smiley
BufferedImage image =;
                texture = AWTTextureIO.newTexture(image, true);
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

BurntPizza (6 views)
2015-10-06 19:04:48

basil_ (42 views)
2015-09-30 17:04:40

shadowstryker (21 views)
2015-09-29 15:55:06

TheSpaceHedgehog (27 views)
2015-09-29 01:58:48

GamerC4 (52 views)
2015-09-24 21:10:38

GamerC4 (70 views)
2015-09-24 21:09:48

htuy (27 views)
2015-09-24 04:57:24

htuy (37 views)
2015-09-24 04:56:35

htuy (25 views)
2015-09-24 04:56:09

htuy (26 views)
2015-09-24 04:47:33
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!