Fixed the graphics whiteout bug I introduced when switching profiles. When Refresh() was being called on the texture, the bitmap wasn't been re-transferred back into the openGL context.

While debugging this, I noticed a separate issue:  when changing profiles, we'd actually call refresh twice.  Removed the spurious call, as reloading profiles doesn't need to concern itself with the image cache - that's already covered by the game options menu.

Also did some minor formatting / cleanup in the JGfx code for PSP - stubbed out a bunch of JLOG calls I had put in while debugging the PNG loading code.
This commit is contained in:
wrenczes@gmail.com
2010-12-02 04:04:03 +00:00
parent 8fa6578757
commit 2693f35506
8 changed files with 223 additions and 204 deletions

View File

@@ -287,10 +287,8 @@ static glslFunctions g_glslfuncts;
JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
:mTex(tex), mX(x), mY(y), mWidth(width), mHeight(height)
{
JASSERT(tex != NULL);
JRenderer::TransferTextureToGLContext(*tex);
JRenderer::GetInstance()->TransferTextureToGLContext(*tex);
mHotSpotX = 0.0f;
mHotSpotY = 0.0f;
@@ -302,7 +300,6 @@ JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
mVFlipped = false;
SetTextureRect(x, y, width, height);
}
void JQuad::SetTextureRect(float x, float y, float w, float h)
@@ -316,7 +313,6 @@ void JQuad::SetTextureRect(float x, float y, float w, float h)
mTY0 = y/mTex->mTexHeight;
mTX1 = (x+w)/mTex->mTexWidth;
mTY1 = (y+h)/mTex->mTexHeight;
}
@@ -350,16 +346,16 @@ JTexture::JTexture() : mBuffer(NULL)
JTexture::~JTexture()
{
checkGlError();
if (mTexId != (GLuint)-1)
glDeleteTextures(1, &mTexId);
checkGlError();
checkGlError();
if (mTexId != (GLuint)-1)
glDeleteTextures(1, &mTexId);
checkGlError();
if (mBuffer)
{
delete [] mBuffer;
mBuffer = NULL;
}
if (mBuffer)
{
delete [] mBuffer;
mBuffer = NULL;
}
}
@@ -1669,7 +1665,7 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
checkGlError();
glGenTextures(1, &texid);
inTexture.mTexId = texid;
JRenderer::GetInstance()->mCurrentTex = texid;
mCurrentTex = texid;
// glError = glGetError();
@@ -1679,7 +1675,7 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
// OpenGL texture has (0,0) at lower-left
// Pay attention when doing texture mapping!!!
glBindTexture(GL_TEXTURE_2D, inTexture.mTexId); // Bind To The Texture ID
glBindTexture(GL_TEXTURE_2D, mCurrentTex); // Bind To The Texture ID
/* NOT USED
if (mode == TEX_TYPE_MIPMAP) // generate mipmaps
@@ -1750,10 +1746,6 @@ JTexture* JRenderer::LoadTexture(const char* filename, int mode, int TextureForm
tex->mTexHeight = textureInfo.mTexHeight;
tex->mBuffer = textureInfo.mBits;
GLuint texid;
//checkGlError();
glGenTextures(1, &texid);
tex->mTexId = texid;
}
return tex;