- added new ini setting to see if this helps fix non power of two texture loading for some ATI video cards, user needs to set this in the ini:

EnableATIHacks=true
This commit is contained in:
Mark Vejvoda
2011-04-28 07:48:19 +00:00
parent 95dcd042a3
commit 15489b066f
6 changed files with 117 additions and 2 deletions

View File

@@ -25,11 +25,12 @@
#include <jpeglib.h>
#include <setjmp.h>
#include <memory>
#include "opengl.h"
#include "leak_dumper.h"
using namespace Shared::Util;
using namespace std;
using namespace Shared::Graphics::Gl;
namespace Shared{ namespace Graphics{
@@ -868,6 +869,24 @@ Pixmap2D::~Pixmap2D() {
deletePixels();
}
void Pixmap2D::Scale(int format, int newW, int newH) {
int useComponents = this->getComponents();
uint8 *newpixels= new uint8[newW * newH * useComponents];
glPixelStorei(GL_PACK_ALIGNMENT, 1);
int error = gluScaleImage( format,
w, h, GL_UNSIGNED_BYTE, pixels,
newW, newH, GL_UNSIGNED_BYTE, newpixels);
if(error != GL_NO_ERROR) {
init(newW,newH,this->components);
pixels = newpixels;
}
else {
assertGl();
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
Pixmap2D* Pixmap2D::loadPath(const string& path) {
//printf("Loading Pixmap2D [%s]\n",path.c_str());