Browse Source

Replaced deprecated gluBuild2DMipmaps().

Thomas Buck 11 years ago
parent
commit
b03b6a8785
1 changed files with 13 additions and 2 deletions
  1. 13
    2
      src/Texture.cpp

+ 13
- 2
src/Texture.cpp View File

699
 	}
699
 	}
700
 }
700
 }
701
 
701
 
702
+GLint deprecated_gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
702
 
703
 
703
 int Texture::loadBufferSlot(unsigned char *image,
704
 int Texture::loadBufferSlot(unsigned char *image,
704
 									 unsigned int width, unsigned int height,
705
 									 unsigned int width, unsigned int height,
783
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
784
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
784
 							 GL_LINEAR_MIPMAP_LINEAR);
785
 							 GL_LINEAR_MIPMAP_LINEAR);
785
 
786
 
786
-		gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height,
787
-								glcMode, GL_UNSIGNED_BYTE, image);
787
+		//gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
788
+        // gluBuild2DMipmaps is deprecated. Replacement by xythobuz
789
+        deprecated_gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
788
 	}
790
 	}
789
 	else
791
 	else
790
 	{
792
 	{
800
 }
802
 }
801
 
803
 
802
 
804
 
805
+// http://mmmovania.blogspot.de/2011/01/opengl-30-and-above-deprecated-func-and.html
806
+// http://www.g-truc.net/post-0256.html
807
+GLint deprecated_gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data) {
808
+    glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
809
+    glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, data);
810
+    return 0;
811
+}
812
+
813
+
803
 void Texture::bindTextureId(unsigned int n)
814
 void Texture::bindTextureId(unsigned int n)
804
 {
815
 {
805
 	if ((int)n == mTextureId || !mTextureIds || n > mTextureCount)
816
 	if ((int)n == mTextureId || !mTextureIds || n > mTextureCount)

Loading…
Cancel
Save