Changeset 4156 in orxonox.OLD for orxonox/branches/md2_loader/src/lib/graphics
- Timestamp:
- May 10, 2005, 11:22:49 PM (20 years ago)
- Location:
- orxonox/branches/md2_loader/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/Makefile.in
r4139 r4156 42 42 subdir = src/lib/graphics/importer 43 43 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 44 $(srcdir)/Makefile.in 44 $(srcdir)/Makefile.in TODO 45 45 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 46 46 am__aclocal_m4_deps = $(top_srcdir)/configure.ac -
orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h
r4149 r4156 181 181 }; 182 182 183 class Helper 184 { 185 186 static createTexture(UINT textureArray[], LPSTR strFileName, int textureID) 187 { 188 AUX_RGBImageRec *pBitmap = NULL; 189 190 if(!strFileName) // Return from the function if no file name was passed in 191 return; 192 193 pBitmap = auxDIBImageLoad(strFileName); // Load the bitmap and store the data 194 195 if(pBitmap == NULL) // If we can't load the file, quit! 196 exit(0); 197 198 // Generate a texture with the associative texture ID stored in the array 199 glGenTextures(1, &textureArray[textureID]); 200 201 // This sets the alignment requirements for the start of each pixel row in memory. 202 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 203 204 // Bind the texture to the texture arrays index and init the texture 205 glBindTexture(GL_TEXTURE_2D, textureArray[textureID]); 206 207 // Build Mipmaps (builds different versions of the picture for distances - looks better) 208 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data); 209 210 // Lastly, we need to tell OpenGL the quality of our texture map. GL_LINEAR_MIPMAP_LINEAR 211 // is the smoothest. GL_LINEAR_MIPMAP_NEAREST is faster than GL_LINEAR_MIPMAP_LINEAR, 212 // but looks blochy and pixilated. Good for slower computers though. 213 214 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); 215 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR); 216 217 // Now we need to free the bitmap data that we loaded since openGL stored it as a texture 218 219 if (pBitmap) // If we loaded the bitmap 220 { 221 if (pBitmap->data) // If there is texture data 222 { 223 free(pBitmap->data); // Free the texture data, we don't need it anymore 224 } 225 226 free(pBitmap); // Free the bitmap structure 227 } 228 } 229 230 }; 231 183 232 #endif /* _ABSTRACT_MODEL_H */
Note: See TracChangeset
for help on using the changeset viewer.