mirror image problem?

Member
Posts: 321
Joined: 2004.10
Post: #1
Here's a problem which I'd image is fairly common. But I don't know
the terminology so I don't know what to search for. I suppose this
is like a mirror image problem?

I've got a photoshop image (that looks fine) and then I save it off
in targa format. My openGL program reads in the
data and displays it as a texture. It seems to be displaying as
if one walked behind it. For instance,

The image in photoshop Displayed in my program

FRONT TNORF (only all the letters face left)

Is there a simple command that I can use to fix this?

I'm thinking that I could tweak the way the data is read in. In stead of
filling in my buffer from 0 to maxSize, maybe fill in the data from maxSize
to 0?

Another mystery is photographs. I've got photos that are fine in photoshop
but when displayed the photographs are orientated on their sides.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
to get a horizontal flip, you must be doing something horribly wrong Rasp

vertical flips are common, since most image formats use coordinate systems upside down from OpenGL's.
Quote this message in a reply
Member
Posts: 184
Joined: 2004.07
Post: #3
You can fix horizontal or vertical flips just by changing your texture coordinates. For the typical vertical flip, texcoord T would just be set to 1-T.

If the way you read input "disagrees" with the way Photoshop writes, you'd have to either get a new graphics reading library or flip coordinates accordingly.
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #4
Duh. Thanks alot. That was relatively painless.

Before:

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f( x, y, 0.0);
glTexCoord2f(1.0f, 0.0f); glVertex3f( x, y+side, 0.0);
glTexCoord2f(1.0f, 1.0f); glVertex3f( x+side, y+side, 0.0);
glTexCoord2f(0.0f, 1.0f); glVertex3f( x+side, y, 0.0);
glEnd();

After:

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f( x, y, 0.0);
glTexCoord2f(1.0f, 0.0f); glVertex3f( x+side, y, 0.0);
glTexCoord2f(1.0f, 1.0f); glVertex3f( x+side, y+side, 0.0);
glTexCoord2f(0.0f, 1.0f); glVertex3f( x, y+side, 0.0);
glEnd();

Well, at least now I've not got a secret Leonardo Da Vinci Coder Ring. (Mirror writing)
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL Mirror Image beg1689 4 4,272 Sep 23, 2005 03:20 PM
Last Post: Duane
  OGL Image Problem Sta7ic 2 2,308 Jul 27, 2003 06:32 PM
Last Post: Mark Levin