Pvr Texture Problems On Gles


TheGoodDoktor

Still Fresh
Joined
Sep 6, 2008
Messages
74
Hi All

I'm now engaged in the long draw out process of converting all my game textures from DDS DXT textures to PRTC textures.
I'm using the PVRTexTool that comes with the ImgTec GLES 1.1 SDK for Windows to convert DDS files to PVR files.
I've just written a PVR file loader based on the ImgTech examples and when I load and draw the textures they appear to be flipped in the Y. I'm not doing any image processing in my loader, just passing the data straight to the glCompressedTexImage2D function. The drawing function is a simple 2d quad renderer with draws the DDS version the right way round on my GL version.
When I load the PVR file back into PVRTexTool, it appears to be the right way round.
I'm using the PVRTC 4Bpp RGBA format, the colours & alpha channel are coming out fine.

Has anyone else had this happen? Am I missing something?

Cheers,
TheGoodDoktor
 
OpenGL has a different coordinate system. 0.0 is a bottom of the screen, while 1.0 is at the top. Easiest fix is just to swap your texture coordinates.
 
Zoxc said:
OpenGL has a different coordinate system. 0.0 is a bottom of the screen, while 1.0 is at the top. Easiest fix is just to swap your texture coordinates.
It doesn't appear to be the coords as the same code draws the dds texture correctly, it's only when I use a PVR texture that it is flipped. Also my uncompressed 4444 & 5551 textures draw fine.

I've posted on the Imgtech forums too, cheers Laurent, I should have thought of that!

Cheers,
TheGoodDoktor
 
Last edited by a moderator:
Are you using Point sprites per chance? Ignore the following rant otherwise.

I had a similar problem. When i draw using point sprites the texture coordinates are flipped on the y-axis. This had me confused for a while because the GLES2 Programming Guide (great book) has an image showing the texcoords as normal but with text describing it as flipped. It also seems to imply that the position coordinates are flipped which, as far as i can see, is not the case. According to the GLES2 spec "The point sprite coordinate origin is UPPER LEFT and cannot be changed.".... i dont know if includes texcoords or just vertex positions.

As a hack for now im just using a fragment shader like:

tmp.x = +gl_PointCoord.x;
tmp.y = -gl_PointCoord.y;
gl_FragColor = texture2D(uTex, tmp);

Anyway still doesn't explain why your getting different results with different texture types.... it just seems a bit buggy to me. I'll probably post this at imgtec aswell.
 
Update:

I got an answer back from ImgTech.
Apparently the PVRTexTool outputs them flipped!
I think they wanted them to be the same orientation as textures that have been rendered to rather that the same orientation as DDS and the other raw formats.
I've requested that they add a flip command line option to PVRTexTool but in the meantime I'm just going to flip them in my batch conversion process.
So there you go.

Cheers,
TheGoodDoktor.
 
Back
Top