Hi dudes!
I'm using PVRTextLib to decompress PVR files and use them in my OpenGL program (level editor) under Windows XP and Visual Studio 2005.
I'd like to obtain a bytes array representing my image, someting like
unsigned char* pixels=(unsigned char*)malloc(Width*Height*Channels);
in order to pass it to OpenGL, like:
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,Width,Heigh,0,GL_RGBA,GL_UNSIGNED_BYTE, pixels);
But I have some questions about usage of PVR library...
After calling
PVRU->DecompressPVR(sOriginalTexture,sDecompressedTexture);
What I have in sDecompressedTexture is always raw data in a R8G8B8 or R8G8B8A8 format?
Or should I call sDecompressedTexture.setPixelType(eInt8StandardPixelType)?
About alpha manipulating:
If a texture does not have alpha channel, should I always get an image with an alpha channel? In other words, should I manually discard these unused pixels if original image had 3 channels? (I have to tell opengl if it is GL_RGBA or GL_RGB and with proper data)
If I use hasAlpha() method, I get a linker error:
1>CTextureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall pvrtexlib::CPVRTexture::hasAlpha(void)const " (__imp_?hasAlpha@CPVRTexture@pvrtexlib@@QBE_NXZ)
1>C:Documents and SettingsRicardoEscritorioiPhonedonkeySpanking_vsReleaseSpanking.exe : fatal error LNK1120: 1 unresolved externals
But other methods like
printf("width: %dn", sDecompressedTexture.getWidth());
printf("height: %dn", sDecompressedTexture.getHeight());
work perfectly. Perhaps there is someting wrong in the lib. Can anyone confirm if hasAlpha() works?
Note: I'm using last version of this library.
BTW, it seems there is a bug on setAlpha(const bool bFalseMips) method and setFlipped(const bool bFalseMips).
Parameters seem to be wrong.
Thanks a lot for your help.
riruilo2009-04-13 11:16:29