New Paste :: Recent Pastes:: Add Line Numbers
hope this helps iridium by godecho
struct Texture { Texture() : bpp(0), width(0), height(0), type(0), refCounter(0), texID(0), wrap_s(GL_REPEAT), wrap_t(GL_REPEAT), pImageData(0), useMipmaps(false) {} ~Texture() { delete [] pImageData; } GLuint bpp; // Image Color Depth In Bits Per Pixel GLuint width; // Image Width GLuint height; // Image Height GLuint type; // Image Type (GL_RGB, GL_RGBA) GLuint refCounter; // Reference Counter GLuint texID; GLint wrap_s; GLint wrap_t; GLubyte *pImageData; // Image Data (Up To 32 Bits) bool useMipmaps; }; glGenTextures(1, &texture->texID); glBindTexture(GL_TEXTURE_2D, texture->texID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texture->wrap_s); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texture->wrap_t); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); if(texture->useMipmaps) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); gluBuild2DMipmaps(GL_TEXTURE_2D, texture->type, texture->width, texture->height, texture->type, GL_UNSIGNED_BYTE, texture->pImageData); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ((textureQuality > 1) ? GL_LINEAR : minFilter)); glTexImage2D(GL_TEXTURE_2D, 0, texture->type, texture->width, texture->height, 0, texture->type, GL_UNSIGNED_BYTE, texture->pImageData); }