Original Post
Hi. I have source code from a website, where it states how to apply a texture to a pyramid. I am unsure of how to do this, and this is the code i have so far: // // Implement basic texture IO functionality // #include "textures.h" // Load a bitmap and setup as an OpenGL texture. Return the textureID OpenGL uses // to reference the texture! GLuint loadTexture(LPTSTR szFileName) { HBITMAP hBMP; BITMAP BMP; GLuint newTexture = 0; // 1. Load bitmap image hBMP = (HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); if (!hBMP) return 0; // 2. Get bitmap object GetObject(hBMP, sizeof(BMP), &BMP); // 3. Setup image as an OpenGL texture glGenTextures(1, &newTexture); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // make the current texture glBindTexture(GL_TEXTURE_2D, newTexture); // Setup texture properties glTexImage2D(GL_TEXTURE_2D, 0, 3, BMP.bmWidth, BMP.bmHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, BMP.bmBits); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // use linear filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // 4. Dispose of unwanted bitmap object DeleteObject(hBMP); // 5. Finally return to calling function the texture ID used to reference the texture image in OpenGL. return newTexture; } i have an image file called texture1.bmp, but am unsure where i need to include it. thanks