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:
@@ -149,10 +149,11 @@ public:
|
||||
** However, this doesn't work if you want to call LoadTexture in a separate worker thread, as
|
||||
** OpenGL has a limitation where only one thread can run the context. Now, the image loading/decompression
|
||||
** happens in LoadTexture, and the JQuad constructor will complete the texture binding with this helper function.
|
||||
**
|
||||
** On PSP, this is a no-op.
|
||||
*/
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
void static TransferTextureToGLContext(JTexture& inTexture);
|
||||
#endif
|
||||
void TransferTextureToGLContext(JTexture& inTexture);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// Create texture from memory on the fly.
|
||||
///
|
||||
|
||||
372
JGE/src/JGfx.cpp
372
JGE/src/JGfx.cpp
@@ -770,6 +770,14 @@ void JRenderer::RenderQuad(JQuad* quad, VertexColor* points)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
** No-op on PSP. This is purely a PC openGL utility.
|
||||
*/
|
||||
void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Taken from:
|
||||
@@ -1054,205 +1062,223 @@ void JRenderer::LoadJPG(TextureInfo &textureInfo, const char *filename, int mode
|
||||
|
||||
int size = tw * th * pixelSize;
|
||||
|
||||
if (useVideoRAM)
|
||||
{
|
||||
if (useVideoRAM)
|
||||
{
|
||||
|
||||
if (pixelSize == 2){
|
||||
bits16 = (u16*)valloc(size);
|
||||
}else{
|
||||
bits32 = (u32*)valloc(size);
|
||||
if (pixelSize == 2)
|
||||
{
|
||||
bits16 = (u16*)valloc(size);
|
||||
}
|
||||
else
|
||||
{
|
||||
bits32 = (u32*)valloc(size);
|
||||
}
|
||||
videoRAMUsed = true;
|
||||
}
|
||||
videoRAMUsed = true;
|
||||
}
|
||||
|
||||
//else
|
||||
if (bits16 == NULL && bits32 == NULL)
|
||||
{
|
||||
videoRAMUsed = false;
|
||||
if (pixelSize == 2){
|
||||
bits16 = (u16*)memalign(16, size);
|
||||
}else{
|
||||
bits32 = (u32*)memalign(16, size);
|
||||
if (bits16 == NULL && bits32 == NULL)
|
||||
{
|
||||
videoRAMUsed = false;
|
||||
if (pixelSize == 2)
|
||||
{
|
||||
bits16 = (u16*)memalign(16, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
bits32 = (u32*)memalign(16, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rgbadata16 = bits16;
|
||||
rgbadata32 = bits32;
|
||||
if (mSwizzle)
|
||||
{
|
||||
if (rgbadata16) rgbadata16 = (u16*) memalign(16, size);
|
||||
if (rgbadata32) rgbadata32 = (u32*) memalign(16, size);
|
||||
if(!rgbadata16 && !rgbadata32)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
if (videoRAMUsed){
|
||||
if (bits16) vfree(bits16);
|
||||
if (bits32) vfree(bits32);
|
||||
}else{
|
||||
if (bits16) free(bits16);
|
||||
if (bits32) free(bits32);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
scanline = (u8 *)malloc(cinfo.output_width * 3);
|
||||
if(!scanline)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
if (videoRAMUsed){
|
||||
if (bits16) vfree(bits16);
|
||||
if (bits32) vfree(bits32);
|
||||
}else{
|
||||
if (bits16) free(bits16);
|
||||
if (bits32) free(bits32);
|
||||
rgbadata16 = bits16;
|
||||
rgbadata32 = bits32;
|
||||
if (mSwizzle)
|
||||
{
|
||||
if (rgbadata16) rgbadata16 = (u16*) memalign(16, size);
|
||||
if (rgbadata32) rgbadata32 = (u32*) memalign(16, size);
|
||||
if(!rgbadata16 && !rgbadata32)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
if (videoRAMUsed)
|
||||
{
|
||||
if (bits16) vfree(bits16);
|
||||
if (bits32) vfree(bits32);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bits16) free(bits16);
|
||||
if (bits32) free(bits32);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (mSwizzle){
|
||||
if (rgbadata16)
|
||||
free(rgbadata16);
|
||||
if (rgbadata32)
|
||||
free(rgbadata32);
|
||||
|
||||
scanline = (u8 *)malloc(cinfo.output_width * 3);
|
||||
if(!scanline)
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
if (videoRAMUsed)
|
||||
{
|
||||
if (bits16) vfree(bits16);
|
||||
if (bits32) vfree(bits32);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bits16) free(bits16);
|
||||
if (bits32) free(bits32);
|
||||
}
|
||||
if (mSwizzle)
|
||||
{
|
||||
if (rgbadata16)
|
||||
free(rgbadata16);
|
||||
if (rgbadata32)
|
||||
free(rgbadata32);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
u16 * currRow16 = rgbadata16;
|
||||
u32 * currRow32 = rgbadata32;
|
||||
u16 color16;
|
||||
u32 color32;
|
||||
while(cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
p = scanline;
|
||||
jpeg_read_scanlines(&cinfo, &scanline, 1);
|
||||
u16 * currRow16 = rgbadata16;
|
||||
u32 * currRow32 = rgbadata32;
|
||||
u16 color16;
|
||||
u32 color32;
|
||||
while(cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
p = scanline;
|
||||
jpeg_read_scanlines(&cinfo, &scanline, 1);
|
||||
|
||||
q16 = currRow16;
|
||||
q32 = currRow32;
|
||||
for(i=0; i<(int)cinfo.output_width; i++){
|
||||
int a = 255;
|
||||
int r = p[0];
|
||||
int g = p[1];
|
||||
int b = p[2];
|
||||
switch (textureMode) {
|
||||
case GU_PSM_5650:
|
||||
color16 = (r >> 3) | ((g >> 2) << 5) | ((b >> 3) << 11);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_5551:
|
||||
color16 = (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_4444:
|
||||
color16 = (r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_8888:
|
||||
color32 = r | (g << 8) | (b << 16) | (a << 24);
|
||||
*(q32) = color32;
|
||||
break;
|
||||
}
|
||||
q16 = currRow16;
|
||||
q32 = currRow32;
|
||||
for (i=0; i<(int)cinfo.output_width; ++i)
|
||||
{
|
||||
int a = 255;
|
||||
int r = p[0];
|
||||
int g = p[1];
|
||||
int b = p[2];
|
||||
switch (textureMode)
|
||||
{
|
||||
case GU_PSM_5650:
|
||||
color16 = (r >> 3) | ((g >> 2) << 5) | ((b >> 3) << 11);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_5551:
|
||||
color16 = (r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_4444:
|
||||
color16 = (r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12);
|
||||
*(q16) = color16;
|
||||
break;
|
||||
case GU_PSM_8888:
|
||||
color32 = r | (g << 8) | (b << 16) | (a << 24);
|
||||
*(q32) = color32;
|
||||
break;
|
||||
}
|
||||
|
||||
p+=3;
|
||||
if (q16) q16+=1;
|
||||
if (q32) q32+=1;
|
||||
}
|
||||
if (currRow32) currRow32+= tw;
|
||||
if (currRow16) currRow16+= tw;
|
||||
}
|
||||
p+=3;
|
||||
if (q16) q16+=1;
|
||||
if (q32) q32+=1;
|
||||
}
|
||||
if (currRow32) currRow32+= tw;
|
||||
if (currRow16) currRow16+= tw;
|
||||
}
|
||||
|
||||
free(scanline);
|
||||
|
||||
try{
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
}catch(...){}
|
||||
|
||||
|
||||
if (mSwizzle)
|
||||
{
|
||||
if (rgbadata16){
|
||||
swizzle_fast((u8*)bits16, (const u8*)rgbadata16, tw*pixelSize, th/*cinfo.output_height*/);
|
||||
free (rgbadata16);
|
||||
try
|
||||
{
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
}
|
||||
if (rgbadata32){
|
||||
swizzle_fast((u8*)bits32, (const u8*)rgbadata32, tw*pixelSize, th/*cinfo.output_height*/);
|
||||
free (rgbadata32);
|
||||
catch(...)
|
||||
{}
|
||||
|
||||
if (mSwizzle)
|
||||
{
|
||||
if (rgbadata16){
|
||||
swizzle_fast((u8*)bits16, (const u8*)rgbadata16, tw*pixelSize, th/*cinfo.output_height*/);
|
||||
free (rgbadata16);
|
||||
}
|
||||
if (rgbadata32){
|
||||
swizzle_fast((u8*)bits32, (const u8*)rgbadata32, tw*pixelSize, th/*cinfo.output_height*/);
|
||||
free (rgbadata32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bits16) textureInfo.mBits = (u8 *)bits16;
|
||||
else textureInfo.mBits = (u8 *)bits32;
|
||||
textureInfo.mWidth = cinfo.output_width;
|
||||
textureInfo.mHeight = cinfo.output_height;
|
||||
textureInfo.mTexWidth = tw;
|
||||
textureInfo.mTexHeight = th;
|
||||
textureInfo.mVRAM =videoRAMUsed;
|
||||
if (bits16) textureInfo.mBits = (u8 *)bits16;
|
||||
else textureInfo.mBits = (u8 *)bits32;
|
||||
textureInfo.mWidth = cinfo.output_width;
|
||||
textureInfo.mHeight = cinfo.output_height;
|
||||
textureInfo.mTexWidth = tw;
|
||||
textureInfo.mTexHeight = th;
|
||||
textureInfo.mVRAM =videoRAMUsed;
|
||||
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
delete [] rawdata;
|
||||
JLOG("-- OK -- JRenderer::LoadJPG");
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
delete [] rawdata;
|
||||
JLOG("-- OK -- JRenderer::LoadJPG");
|
||||
}
|
||||
|
||||
|
||||
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureMode)
|
||||
{
|
||||
JLOG("JRenderer::LoadTexture");
|
||||
TextureInfo textureInfo;
|
||||
textureInfo.mVRAM = false;
|
||||
textureInfo.mBits = NULL;
|
||||
JLOG("JRenderer::LoadTexture");
|
||||
TextureInfo textureInfo;
|
||||
textureInfo.mVRAM = false;
|
||||
textureInfo.mBits = NULL;
|
||||
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (strstr(filename, ".jpg")!=NULL || strstr(filename, ".JPG")!=NULL)
|
||||
LoadJPG(textureInfo, filename, mode, textureMode);
|
||||
else if(strstr(filename, ".gif")!=NULL || strstr(filename, ".GIF")!=NULL) {
|
||||
textureMode = TEXTURE_FORMAT; //textureMode not supported in Gif yet
|
||||
LoadGIF(textureInfo,filename, mode, textureMode);
|
||||
}
|
||||
else if(strstr(filename, ".png")!=NULL || strstr(filename, ".PNG")!=NULL) {
|
||||
textureMode = TEXTURE_FORMAT; //textureMode not supported in PNG yet
|
||||
ret = LoadPNG(textureInfo, filename, mode, textureMode);
|
||||
if (ret < 0) {
|
||||
char buf[512];
|
||||
sprintf(buf, "--LoadPNG sent error code: %i for file %s", ret, filename);
|
||||
JLOG(buf);
|
||||
if (strstr(filename, ".jpg")!=NULL || strstr(filename, ".JPG")!=NULL)
|
||||
LoadJPG(textureInfo, filename, mode, textureMode);
|
||||
else if(strstr(filename, ".gif")!=NULL || strstr(filename, ".GIF")!=NULL)
|
||||
{
|
||||
textureMode = TEXTURE_FORMAT; //textureMode not supported in Gif yet
|
||||
LoadGIF(textureInfo,filename, mode, textureMode);
|
||||
}
|
||||
else if(strstr(filename, ".png")!=NULL || strstr(filename, ".PNG")!=NULL)
|
||||
{
|
||||
textureMode = TEXTURE_FORMAT; //textureMode not supported in PNG yet
|
||||
ret = LoadPNG(textureInfo, filename, mode, textureMode);
|
||||
if (ret < 0)
|
||||
{
|
||||
char buf[512];
|
||||
sprintf(buf, "--LoadPNG sent error code: %i for file %s", ret, filename);
|
||||
JLOG(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (textureInfo.mBits == NULL)
|
||||
return NULL;
|
||||
if (textureInfo.mBits == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
bool done = false;
|
||||
JLOG("Allocating Texture");
|
||||
JTexture* tex = new JTexture();
|
||||
if (tex)
|
||||
{
|
||||
if (mImageFilter != NULL)
|
||||
mImageFilter->ProcessImage((PIXEL_TYPE*)textureInfo.mBits, textureInfo.mWidth, textureInfo.mHeight);
|
||||
bool done = false;
|
||||
JTexture* tex = new JTexture();
|
||||
if (tex)
|
||||
{
|
||||
if (mImageFilter != NULL)
|
||||
mImageFilter->ProcessImage((PIXEL_TYPE*)textureInfo.mBits, textureInfo.mWidth, textureInfo.mHeight);
|
||||
|
||||
tex->mTexId = mTexCounter++;
|
||||
tex->mTextureFormat = textureMode;
|
||||
tex->mWidth = textureInfo.mWidth;
|
||||
tex->mHeight = textureInfo.mHeight;
|
||||
tex->mTexWidth = textureInfo.mTexWidth;
|
||||
tex->mTexHeight = textureInfo.mTexHeight;
|
||||
tex->mInVideoRAM = textureInfo.mVRAM;
|
||||
tex->mBits = (PIXEL_TYPE *)textureInfo.mBits;
|
||||
tex->mTexId = mTexCounter++;
|
||||
tex->mTextureFormat = textureMode;
|
||||
tex->mWidth = textureInfo.mWidth;
|
||||
tex->mHeight = textureInfo.mHeight;
|
||||
tex->mTexWidth = textureInfo.mTexWidth;
|
||||
tex->mTexHeight = textureInfo.mTexHeight;
|
||||
tex->mInVideoRAM = textureInfo.mVRAM;
|
||||
tex->mBits = (PIXEL_TYPE *)textureInfo.mBits;
|
||||
|
||||
done = true;
|
||||
done = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (!done)
|
||||
{
|
||||
SAFE_DELETE(tex);
|
||||
}
|
||||
|
||||
if (!done)
|
||||
{
|
||||
SAFE_DELETE(tex);
|
||||
}
|
||||
|
||||
JLOG("-- OK -- JRenderer::LoadTexture");
|
||||
return tex;
|
||||
JLOG("-- OK -- JRenderer::LoadTexture");
|
||||
return tex;
|
||||
|
||||
}
|
||||
|
||||
@@ -1300,8 +1326,8 @@ void ReadPngLine( png_structp& png_ptr, u32_ptr& line, png_uint_32 width, int pi
|
||||
//------------------------------------------------------------------------------------------------
|
||||
int JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode, int textureMode)
|
||||
{
|
||||
JLOG("JRenderer::LoadPNG: ");
|
||||
JLOG(filename);
|
||||
//JLOG("JRenderer::LoadPNG: ");
|
||||
//JLOG(filename);
|
||||
textureInfo.mBits = NULL;
|
||||
|
||||
bool useVideoRAM = (mode == TEX_TYPE_USE_VRAM);
|
||||
@@ -1319,13 +1345,13 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode,
|
||||
JFileSystem* fileSystem = JFileSystem::GetInstance();
|
||||
if (!fileSystem->OpenFile(filename)) return JGE_ERR_CANT_OPEN_FILE;
|
||||
|
||||
JLOG("PNG opened - creating read struct");
|
||||
//JLOG("PNG opened - creating read struct");
|
||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL) {
|
||||
fileSystem->CloseFile();
|
||||
return JGE_ERR_PNG;
|
||||
}
|
||||
JLOG("Setting error callback func");
|
||||
//JLOG("Setting error callback func");
|
||||
png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, PNGCustomWarningFn);
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
@@ -1377,7 +1403,7 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode,
|
||||
const unsigned int kVerticalBlockSize = 8;
|
||||
if (mSwizzle)
|
||||
{
|
||||
JLOG("allocating swizzle buffer");
|
||||
//JLOG("allocating swizzle buffer");
|
||||
buffer = (PIXEL_TYPE*) memalign(16, texWidth * kVerticalBlockSize * sizeof(PIXEL_TYPE));
|
||||
if (!buffer)
|
||||
{
|
||||
@@ -1452,14 +1478,14 @@ int JRenderer::LoadPNG(TextureInfo &textureInfo, const char* filename, int mode,
|
||||
}
|
||||
}
|
||||
|
||||
JLOG("Freeing line");
|
||||
//JLOG("Freeing line");
|
||||
free (line);
|
||||
JLOG("Reading end");
|
||||
//JLOG("Reading end");
|
||||
png_read_end(png_ptr, info_ptr);
|
||||
JLOG("Destroying read struct");
|
||||
//JLOG("Destroying read struct");
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
|
||||
|
||||
JLOG("Closing PNG");
|
||||
//JLOG("Closing PNG");
|
||||
fileSystem->CloseFile();
|
||||
|
||||
if (done)
|
||||
@@ -2217,4 +2243,4 @@ void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius,
|
||||
void JRenderer::SetImageFilter(JImageFilter* imageFilter)
|
||||
{
|
||||
mImageFilter = imageFilter;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
//The sanity=false option returns the adjusted path even if the file doesn't exist.
|
||||
string profileFile(string filename="", string fallback="", bool sanity=false,bool relative=false);
|
||||
|
||||
void reloadProfile(bool images = true); //Reloads profile using current options[ACTIVE_PROFILE]
|
||||
void reloadProfile(); //Reloads profile using current options[ACTIVE_PROFILE]
|
||||
void checkProfile(); //Confirms that a profile is loaded and contains a collection.
|
||||
void createUsersFirstDeck(int setId);
|
||||
|
||||
|
||||
@@ -635,12 +635,10 @@ string GameSettings::profileFile(string filename, string fallback, bool sanity,
|
||||
return buf;
|
||||
}
|
||||
|
||||
void GameSettings::reloadProfile(bool images)
|
||||
void GameSettings::reloadProfile()
|
||||
{
|
||||
SAFE_DELETE(profileOptions);
|
||||
checkProfile();
|
||||
if (images)
|
||||
WResourceManager::Instance()->Refresh(); //Update images
|
||||
}
|
||||
|
||||
void GameSettings::checkProfile()
|
||||
|
||||
@@ -509,7 +509,7 @@ void GameStateMenu::Update(float dt)
|
||||
}
|
||||
|
||||
//Reload list of unlocked sets, now that we know about the sets.
|
||||
options.reloadProfile(false);
|
||||
options.reloadProfile();
|
||||
genNbCardsStr();
|
||||
resetDirectory();
|
||||
//All major things have been loaded, resize the cache to use it as efficiently as possible
|
||||
|
||||
@@ -139,7 +139,7 @@ void GameStateOptions::Update(float dt)
|
||||
if (newProfile != "")
|
||||
{
|
||||
options[Options::ACTIVE_PROFILE] = newProfile;
|
||||
options.reloadProfile(false);
|
||||
options.reloadProfile();
|
||||
optionsTabs->Reload();
|
||||
}
|
||||
newProfile = "";
|
||||
@@ -192,7 +192,7 @@ void GameStateOptions::Update(float dt)
|
||||
}
|
||||
if (mReload)
|
||||
{
|
||||
options.reloadProfile(true);
|
||||
options.reloadProfile();
|
||||
Translator::EndInstance();
|
||||
Translator::GetInstance()->init();
|
||||
optionsTabs->Reload();
|
||||
|
||||
@@ -252,13 +252,15 @@ void WCachedTexture::Refresh()
|
||||
texture = NULL;
|
||||
|
||||
if (!Attempt(mFilename, loadedMode, error))
|
||||
SAFE_DELETE(texture);
|
||||
SAFE_DELETE(texture);
|
||||
|
||||
if (!texture)
|
||||
texture = old;
|
||||
else
|
||||
SAFE_DELETE(old);
|
||||
|
||||
JRenderer::GetInstance()->TransferTextureToGLContext(*texture);
|
||||
|
||||
for (vector<WTrackedQuad*>::iterator it = trackedQuads.begin(); it != trackedQuads.end(); it++)
|
||||
{
|
||||
if ((*it) && (*it)->quad) (*it)->quad->mTex = texture;
|
||||
|
||||
Reference in New Issue
Block a user