mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 07:28:59 +02:00
- bugfixes, some related to things pointed out by valgrind, some from opengl research and some for more stable operation
This commit is contained in:
@@ -790,17 +790,27 @@ void Texture2DGl::init(Filter filter, int maxAnisotropy) {
|
||||
//gen texture
|
||||
glGenTextures(1, &handle);
|
||||
glBindTexture(GL_TEXTURE_2D, handle);
|
||||
|
||||
//wrap params
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
|
||||
|
||||
//maxAnisotropy
|
||||
if(isGlExtensionSupported("GL_EXT_texture_filter_anisotropic")) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy);
|
||||
}
|
||||
|
||||
if(mipmap) {
|
||||
GLuint glFilter= filter==fTrilinear? GL_LINEAR_MIPMAP_LINEAR: GL_LINEAR_MIPMAP_NEAREST;
|
||||
|
||||
//build mipmaps
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glFilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
/*
|
||||
* Replaced this call due to: http://www.opengl.org/wiki/Common_Mistakes#gluBuild2DMipmaps
|
||||
*
|
||||
int error= gluBuild2DMipmaps(
|
||||
GL_TEXTURE_2D, glCompressionFormat,
|
||||
pixmap.getW(), pixmap.getH(),
|
||||
glFormat, GL_UNSIGNED_BYTE, pixels);
|
||||
@@ -965,17 +975,30 @@ void TextureCubeGl::init(Filter filter, int maxAnisotropy) {
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 6; ++i) {
|
||||
//params
|
||||
const Pixmap2D *currentPixmap= pixmap.getFace(i);
|
||||
|
||||
GLint glFormat= toFormatGl(format, currentPixmap->getComponents());
|
||||
GLint glInternalFormat= toInternalFormatGl(format, currentPixmap->getComponents());
|
||||
GLint glCompressionFormat = toCompressionFormatGl(glInternalFormat);
|
||||
if(forceCompressionDisabled == true || (currentPixmap->getPixelByteCount() > 0 && currentPixmap->getPixelByteCount() <= MIN_BYTES_TO_COMPRESS)) {
|
||||
glCompressionFormat = glInternalFormat;
|
||||
}
|
||||
|
||||
//pixel init var
|
||||
const uint8* pixels= pixmapInit? currentPixmap->getPixels(): NULL;
|
||||
GLenum target= GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
|
||||
|
||||
if(mipmap) {
|
||||
|
||||
/*
|
||||
* Replaced this call due to: http://www.opengl.org/wiki/Common_Mistakes#gluBuild2DMipmaps
|
||||
*
|
||||
int error= gluBuild2DMipmaps(
|
||||
target, glCompressionFormat,
|
||||
currentPixmap->getW(), currentPixmap->getH(),
|
||||
glFormat, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
*/
|
||||
|
Reference in New Issue
Block a user