Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /** \file gameengine/Ketsji/BL_Texture.cpp | 1 /** \file gameengine/Ketsji/BL_Texture.cpp |
2 * \ingroup ketsji | 2 * \ingroup ketsji |
3 */ | 3 */ |
4 // ------------------------------------ | 4 // ------------------------------------ |
5 | 5 |
6 #include "GL/glew.h" | 6 #include "GL/glew.h" |
7 | 7 |
8 #include <iostream> | 8 #include <iostream> |
9 #include <map> | 9 #include <map> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 glBindTexture(GL_TEXTURE_2D, mTexture); | 218 glBindTexture(GL_TEXTURE_2D, mTexture); |
219 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_L INEAR); | 219 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_L INEAR); |
220 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 220 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
221 | 221 |
222 height = ibuf->x; | 222 height = ibuf->x; |
223 width = ibuf->y; | 223 width = ibuf->y; |
224 blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16; | 224 blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16; |
225 for (int i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) | 225 for (int i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) |
dfelinto
2011/09/01 09:37:16
Is part of this code to assure 1D images have 1 pi
| |
226 { | 226 { |
227 if (width == 0) | 227 if (width == 0) |
228 width = 1; | 228 width = 1; |
229 if (height == 0) | 229 if (height == 0) |
230 height = 1; | 230 height = 1; |
231 | 231 |
232 size = ((width+3)/4)*((height+3)/4)*blocksize; | 232 size = ((width+3)/4)*((height+3)/4)*blocksize; |
dfelinto
2011/09/01 09:37:16
where does this +3/4 come from? comments here woul
| |
233 | 233 |
234 glCompressedTexImage2D(GL_TEXTURE_2D, i, format, width, height, | 234 glCompressedTexImage2D(GL_TEXTURE_2D, i, format, width, height, |
235 0, size, ibuf->dds_data.data + offset); | 235 0, size, ibuf->dds_data.data + offset); |
236 | 236 |
237 err = glGetError(); | 237 err = glGetError(); |
238 | 238 |
239 if (err != GL_NO_ERROR) | 239 if (err != GL_NO_ERROR) |
240 printf("OpenGL error: %s\nFormat: %x\n", gluErrorString( err), format); | 240 printf("OpenGL error: %s\nFormat: %x\n", gluErrorString( err), format); |
241 | 241 |
242 offset += size; | 242 offset += size; |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 if(ibuf) { | 738 if(ibuf) { |
739 IMB_freeImBuf(ibuf); | 739 IMB_freeImBuf(ibuf); |
740 env->cube[part]= NULL; | 740 env->cube[part]= NULL; |
741 } | 741 } |
742 } | 742 } |
743 env->ok= 0; | 743 env->ok= 0; |
744 } | 744 } |
745 | 745 |
746 | 746 |
747 } // extern C | 747 } // extern C |
LEFT | RIGHT |