-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture->pixels);
-}
+
+ // Setting texture mode.
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+
+
+ // Genereate the texture using the above information.
+ switch ( texturebpp )
+ {
+ case 16:
+ // Normal 16bpp depth based textures consist out of GL_RGB5 and doesn't have support for Alpha channels.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ break;
+ case 24:
+ // The 24bpp depth based textures consist out of GL_RGB8 and doesn't have support for Alpha channels.
+ //
+ // IMPORTANT : If you don't use Alpha. Use textures with a depth of 16bpp.
+ // If you use Alpha. Use textures with a depth of 32bpp.
+ // 24bpp textures are SLOW and avoid them at all costst!
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture->w, texture->h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ break;
+ case 32:
+ default:
+ // The 32bpp depth based textures consist out of GL_RGBA8 and has support for Alpha channels.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture->w, texture->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ break;
+ }
+
+}